/* Celena CMS — admin panel */

/* ============================================================
   Layout
   ============================================================ */
body.admin {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: grid-template-columns 0.2s ease;
}
body.admin.is-collapsed,
html.is-collapsed body.admin { grid-template-columns: 72px 1fr; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 18px 0 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
.sidebar { scrollbar-color: var(--scroll-thumb, #c8ccd9) transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--scroll-thumb, #c8ccd9); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover, var(--accent)); }
[data-theme="dark"] { --scroll-thumb: #3a4158; --scroll-thumb-hover: #55607e; }
[data-theme="dark"] html, [data-theme="dark"] body { scrollbar-color: var(--scroll-thumb) transparent; }
[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 5px; border: 2px solid var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

/* Brand */
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 16px 22px; min-height: 46px; white-space: nowrap;
  text-decoration: none; color: inherit;
}
.sb-brand:hover { text-decoration: none; }
.sb-logo-ico {
  width: 36px; height: 36px; flex-shrink: 0; display: block;
  transition: transform 0.25s ease;
}
.sb-brand:hover .sb-logo-ico { transform: rotate(-18deg) scale(1.05); }
.sb-text { display: flex; flex-direction: column; gap: 3px; line-height: 1.1; overflow: hidden; }
.sb-text b { color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.sb-ver {
  display: inline-block; width: fit-content; padding: 1px 7px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px;
}
.is-collapsed .sb-text { display: none; }
.is-collapsed .sb-brand { justify-content: center; padding: 12px 0 22px; }

/* Nav */
.sb-nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-section-label {
  padding: 16px 12px 6px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); opacity: 0.7;
}
.sb-section-label span { display: inline; }
.is-collapsed .sb-section-label {
  padding: 10px 4px 4px; text-align: center;
}
.is-collapsed .sb-section-label span { display: none; }
.is-collapsed .sb-section-label::before {
  content: ""; display: block; height: 1px;
  background: var(--border-soft); margin: 4px auto;
  width: 24px;
}

/* Группа с подменю (плагины и т.п.) — мягкая карточка вокруг parent + children */
.sb-group {
  display: flex; flex-direction: column;
  border-radius: 12px;
  transition: background 0.2s ease;
}
.sb-group.is-open { background: rgba(109, 92, 255, 0.04); padding-bottom: 4px; }
[data-theme="dark"] .sb-group.is-open { background: rgba(109, 92, 255, 0.08); }

.sb-group .sb-link.has-sub {
  background: transparent; border: 0;
  width: 100%; text-align: left;
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer; border-radius: 10px;
}
.sb-group .sb-link.has-sub:hover { background: var(--surface-2); color: var(--text); }
.sb-group .sb-link.has-sub.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  box-shadow: 0 6px 18px rgba(109, 92, 255, 0.35);
  border-radius: 12px;
}
.sb-group.is-open .sb-link.has-sub.active { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }

.sb-group .sb-sub-caret {
  margin-left: auto; flex-shrink: 0;
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.sb-group.is-open .sb-sub-caret { transform: rotate(180deg); opacity: 1; }

.sb-group .sb-sub {
  display: none; flex-direction: column; gap: 1px;
  padding: 4px 6px 0 36px;
  position: relative;
}
.sb-group .sb-sub::before {
  content: ""; position: absolute;
  left: 22px; top: 6px; bottom: 6px;
  width: 2px; border-radius: 1px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  opacity: 0.4;
}
.sb-group.is-open .sb-sub { display: flex; }

.sb-sublink {
  display: flex; align-items: center;
  padding: 8px 14px; color: var(--text-muted);
  border-radius: 8px; font-size: 13px; font-weight: 500;
  text-decoration: none; letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.sb-sublink:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.sb-sublink.active {
  color: var(--accent); background: var(--accent-soft); font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(109, 92, 255, 0.25);
}
.is-collapsed .sb-group .sb-sub { display: none; }
.is-collapsed .sb-group .sb-sub-caret { display: none; }
.is-collapsed .sb-group.is-open { background: transparent; padding: 0; }

.sb-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; color: var(--text-muted);
  border-radius: 10px; font-size: 14px; font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.sb-nav a:hover { background: var(--surface-2); color: var(--text); }
.sb-nav a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  box-shadow: 0 4px 14px rgba(109, 92, 255, 0.3);
}
.sb-nav a .sb-ico {
  flex-shrink: 0; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  stroke-width: 1.75;
}
.sb-nav a:hover .sb-ico { stroke-width: 2; }
.sb-nav a.active .sb-ico { stroke-width: 2; }
.is-collapsed .sb-nav a { justify-content: center; padding: 10px; }
.is-collapsed .sb-nav a .sb-label { display: none; }
.is-collapsed .sb-nav a.active { box-shadow: 0 4px 14px rgba(109, 92, 255, 0.3); }

/* Toggle button (desktop collapse) — живёт в топбаре, рядом с заголовком */
.sb-toggle {
  width: 28px; height: 28px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; padding: 0;
  margin-right: 8px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.sb-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ============================================================
   Content area
   ============================================================ */
.content { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(8px);
}
.topbar .title { font-weight: 600; font-size: 15px; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .user-name {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none;
  padding: 5px 10px; border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.topbar .user-name:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.topbar .logout {
  color: var(--text-muted); text-decoration: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 50%;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.topbar .logout:hover { color: var(--danger); border-color: var(--danger); background: rgba(239,68,68,0.08); text-decoration: none; }
.topbar .theme-cycle,
.topbar .site-link {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 13px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
  text-decoration: none;
}
.topbar .theme-cycle:hover,
.topbar .site-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
/* Кнопка-цикл несёт три иконки, видна только иконка текущего режима темы. */
.theme-cycle-ico { display: none; line-height: 0; }
html[data-theme-mode="light"] .theme-cycle-ico[data-theme-ico="light"],
html[data-theme-mode="dark"] .theme-cycle-ico[data-theme-ico="dark"],
html[data-theme-mode="auto"] .theme-cycle-ico[data-theme-ico="auto"],
html:not([data-theme-mode]) .theme-cycle-ico[data-theme-ico="auto"] { display: inline-flex; }
/* Language dropdown */
.lang-dd { position: relative; display: inline-block; margin-right: 6px; }
.lang-dd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 9px; border-radius: 8px;
  font-size: 12px; font-weight: 500; font-family: inherit;
  cursor: pointer; height: 32px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.lang-dd-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.lang-dd-flag { display: none; }
.lang-dd-code-lg { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; }
.lang-dd-caret { font-size: 9px; opacity: 0.7; }
.lang-dd-chip {
  flex: 0 0 auto;
  width: 28px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  border-radius: 5px; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
}
.lang-dd-item.active .lang-dd-chip { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.lang-dd-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: 0 10px 32px rgba(0,0,0,0.16);
  padding: 4px; z-index: 40;
  overflow: hidden;
}
.lang-dd-menu[hidden] { display: none; }
.lang-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  text-decoration: none; color: var(--text);
  font-size: 13px;
}
.lang-dd-item:hover { background: var(--surface-2); text-decoration: none; }
.lang-dd-item.active { background: var(--accent-soft); color: var(--accent); }
.lang-dd-item .lang-dd-name { flex: 1; font-weight: 500; }

/* Custom-Fields form: пошаговая форма с карточками-типами и динамическими панелями */
.cf-section-h {
  margin: 28px 0 12px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); text-transform: none; letter-spacing: 0;
  display: flex; align-items: center; gap: 10px;
}
.cf-section-h::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.req { color: var(--danger); }

.cf-type-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.cf-type-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  cursor: pointer; text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.cf-type-card:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.cf-type-card.is-selected {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cf-type-card .cf-type-ico { color: var(--text-muted); }
.cf-type-card.is-selected .cf-type-ico { color: var(--accent); }
.cf-type-label { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 6px; }
.cf-type-hint { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.cf-panel {
  padding: 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); margin-bottom: 12px;
  border: 1px solid var(--border-soft);
}
.cf-panel .form-group { margin-bottom: 0; }
.cf-panel .form-group + .form-group { margin-top: 10px; }

.cf-options { display: flex; flex-direction: column; gap: 6px; }
.cf-option-row {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 4px 4px 8px;
}
.cf-option-row.is-dragging { opacity: 0.55; box-shadow: 0 4px 12px rgba(0,0,0,0.12); transform: scale(1.01); }
body.is-dragging-cursor, body.is-dragging-cursor * { cursor: grabbing !important; user-select: none !important; }
.cf-option-handle {
  cursor: grab; color: var(--text-muted); user-select: none;
  padding: 4px 6px; font-size: 14px; line-height: 1;
}
.cf-option-handle:active { cursor: grabbing; }
.cf-option-row input {
  flex: 1; border: 0 !important; padding: 6px 8px !important;
  background: transparent !important; font-size: 13px;
}
.cf-option-row input:focus { outline: none !important; box-shadow: none !important; }
.cf-option-del {
  background: transparent; border: 0; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}
.cf-option-del:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.cf-option-row--rich .cf-option-label { flex: 1; }
.cf-option-row--rich input[type="color"] {
  flex: 0 0 auto !important;
  width: 32px !important; height: 26px !important;
  padding: 0 !important; border: 1px solid var(--border) !important;
  border-radius: 4px; cursor: pointer; background: transparent !important;
}
.cf-option-color { display: inline-flex; align-items: center; }
.cf-option-image {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
}
.cf-option-image-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 4px 8px; font-size: 12px; color: var(--text-muted);
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.cf-option-image-btn:hover { background: var(--bg); color: var(--text); }
.cf-option-image-btn:disabled { opacity: 0.6; cursor: wait; }
.cf-option-image-btn svg { flex: 0 0 auto; }
.cf-option-image-thumb {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 5px;
  overflow: hidden; background: var(--surface-2);
}
.cf-option-image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cf-option-image-thumb[hidden] { display: none; }
.cf-option-image-remove {
  position: absolute; top: -6px; right: -6px;
  width: 16px; height: 16px; border-radius: 50%; border: 0;
  background: var(--danger, #ef4444); color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}

.cf-gallery { }
.cf-gallery-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.cf-gallery-cell {
  position: relative; width: 90px; height: 90px;
  border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.cf-gallery-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cf-gallery-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(15,23,42,0.78); color: #fff; border: 0;
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.cf-gallery-del:hover { background: var(--danger); }

/* Shop variations editor */
.var-section-h {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 12px; font-size: 14px; font-weight: 600;
  color: var(--text-muted);
}
.var-opt-card {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px;
}
.var-opt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.var-opt-name {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-weight: 600;
}
.var-opt-del {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  font-size: 16px; line-height: 1;
}
.var-opt-del:hover { color: var(--danger); border-color: var(--danger); }
.var-opt-values { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.var-opt-value {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 4px 4px 8px;
}
.var-opt-value input {
  flex: 1; border: 0 !important; padding: 6px 8px !important;
  background: transparent !important; font-size: 13px;
}
.var-opt-value input:focus { outline: none !important; box-shadow: none !important; }
.var-opt-value button {
  background: transparent; border: 0; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 5px; cursor: pointer;
  font-size: 16px; line-height: 1;
}
.var-opt-value button:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.var-matrix-wrap { overflow-x: auto; margin-top: 8px; }
.var-matrix-table { font-size: 12.5px; }
.var-matrix-table th { font-weight: 600; }
.var-matrix-table input[type="number"],
.var-matrix-table input[type="text"] {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); color: var(--text); font-size: 12.5px;
}
.var-image-cell { display: inline-block; width: 36px; height: 36px; vertical-align: middle; margin-right: 6px; }
.var-image-cell img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; }

/* Front: variation selectors */
.variation-options { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.variation-option { display: flex; flex-direction: column; gap: 4px; }
.variation-option-name { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.variation-option select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg, #fff); color: var(--text, #111); font-size: 14px; min-width: 200px;
}
.cart-variation-label { font-size: 11px; margin-top: 2px; }

/* Универсальный drawer документации (выезжает справа). */
.docs-drawer,
.tag-docs-drawer {
  position: fixed; inset: 0; z-index: 2500;
  display: flex; pointer-events: none;
}
.docs-drawer:not([hidden]),
.tag-docs-drawer:not([hidden]) { pointer-events: auto; }
.docs-drawer-backdrop,
.tag-docs-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 0.25s ease;
}
.docs-drawer.is-open .docs-drawer-backdrop,
.tag-docs-drawer.is-open .tag-docs-drawer-backdrop { opacity: 1; }
.docs-drawer-panel,
.tag-docs-drawer-panel {
  margin-left: auto; position: relative;
  width: 80%; max-width: 1100px;
  background: var(--bg); border-left: 1px solid var(--border-soft);
  box-shadow: -10px 0 40px rgba(0,0,0,0.18);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s cubic-bezier(.2,.8,.2,1);
}
.docs-drawer.is-open .docs-drawer-panel,
.tag-docs-drawer.is-open .tag-docs-drawer-panel { transform: translateX(0); }
.docs-drawer-head,
.tag-docs-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
}
.docs-drawer-head h2,
.tag-docs-drawer-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.docs-drawer-close,
.tag-docs-drawer-close {
  background: transparent; border: 0; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}
.docs-drawer-close:hover,
.tag-docs-drawer-close:hover { background: var(--surface-2); color: var(--danger); }
.docs-drawer-body,
.tag-docs-drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.docs-drawer-body .tag-docs,
.tag-docs-drawer-body .tag-docs { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .docs-drawer-panel,
  .tag-docs-drawer-panel { width: 100%; }
}

/* Документация плагина внутри drawer'а */
.plugin-docs-head { margin-bottom: 16px; }
.plugin-docs-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.plugin-docs-meta { display: inline-block; margin-right: 10px; font-size: 12px; }
.plugin-docs-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.plugin-docs-tab {
  padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  background: var(--surface-2); border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.plugin-docs-tab:hover { color: var(--text); text-decoration: none; }
.plugin-docs-tab.is-active {
  background: var(--accent-soft); color: var(--accent);
  border-color: rgba(109, 92, 255, 0.25);
}
.plugin-docs-body.markdown-body { font-size: 14px; line-height: 1.6; color: var(--text); }
.plugin-docs-body h1 { font-size: 22px; margin: 24px 0 12px; }
.plugin-docs-body h2 { font-size: 18px; margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft); }
.plugin-docs-body h3 { font-size: 15px; margin: 18px 0 8px; color: var(--text-muted); }
.plugin-docs-body p { margin: 8px 0; }
.plugin-docs-body ul, .plugin-docs-body ol { padding-left: 24px; margin: 8px 0; }
.plugin-docs-body li { margin: 4px 0; }
.plugin-docs-body code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }
.plugin-docs-body pre { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; }
.plugin-docs-body pre code { background: transparent; padding: 0; }
.plugin-docs-body a { color: var(--accent); }
.plugin-docs-body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.plugin-docs-body th, .plugin-docs-body td { border: 1px solid var(--border-soft); padding: 8px 10px; text-align: left; vertical-align: top; }
.plugin-docs-body blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 10px 0; color: var(--text-muted); }

/* Tag docs */
.tag-docs { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.tag-docs-group {
  grid-column: 1 / -1;
  margin: 8px 0 -4px; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.tag-doc-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 12px;
}
.tag-doc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tag-doc-name { background: var(--accent-soft); color: var(--accent); padding: 2px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.tag-doc-label { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.tag-doc-desc { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: 0; }
.tag-doc-params-title,
.tag-doc-example-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 6px;
}
.tag-doc-params-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tag-doc-params-table th { text-align: left; padding: 4px 8px 4px 0; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border-soft); }
.tag-doc-params-table td { padding: 6px 8px 6px 0; border-bottom: 1px dashed var(--border-soft); vertical-align: top; }
.tag-doc-params-table tr:last-child td { border-bottom: 0; }
.tag-doc-req { font-size: 10px; text-transform: uppercase; color: var(--text-muted); }
.tag-doc-req.required { color: var(--danger); font-weight: 600; }
.tag-doc-example pre {
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 6px; padding: 10px 12px; margin: 0;
  font-size: 12px; overflow-x: auto;
}
.tag-doc-example pre code { color: var(--text); }

/* Компактный инлайн-picker обложки: миниатюра + кнопка, × поверх миниатюры */
.cover-inline { display: flex; align-items: center; gap: 10px; position: relative; }
.cover-thumb {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  position: relative;
}
.cover-thumb:has(img) { border-style: solid; border-color: var(--border); }
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-del {
  position: absolute; top: -6px; left: 32px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(15, 23, 42, 0.78); color: #fff;
  border: 2px solid var(--surface);
  cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; line-height: 1;
  z-index: 2;
  transition: background 0.15s ease, transform 0.15s ease;
}
.cover-del:hover { background: var(--danger); transform: scale(1.1); }
.cover-inline:not(:has(.cover-thumb img)) .cover-del { display: none; }

/* Двухколоночный row "Заголовок + Обложка" — обложка у́же */
.form-row-title-cover { grid-template-columns: 2fr 1fr; }

/* Lightbox (Celena.lightbox) */
.celena-lb-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
}
.celena-lb-overlay.is-visible { opacity: 1; }
.celena-lb-img {
  max-width: 92vw; max-height: 90vh;
  display: block; object-fit: contain;
  border-radius: 6px; background: #111;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
}
.celena-lb-close, .celena-lb-prev, .celena-lb-next {
  position: fixed; background: rgba(255,255,255,0.12); color: #fff;
  border: 0; border-radius: 50%; width: 44px; height: 44px;
  font-size: 22px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.celena-lb-close:hover, .celena-lb-prev:hover, .celena-lb-next:hover {
  background: rgba(255,255,255,0.25); transform: scale(1.06);
}
.celena-lb-close { top: 20px; right: 20px; }
.celena-lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.celena-lb-next { right: 20px; top: 50%; transform: translateY(-50%); }
.celena-lb-prev:hover { transform: translateY(-50%) scale(1.06); }
.celena-lb-next:hover { transform: translateY(-50%) scale(1.06); }
.celena-lb-counter {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.75); font-size: 13px;
  background: rgba(0,0,0,0.45); padding: 6px 14px; border-radius: 999px;
}

/* Modal (Celena.alert / Celena.confirm) */
.celena-modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.18s ease;
}
.celena-modal-overlay.is-visible { opacity: 1; }
.celena-modal {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  padding: 22px 22px 18px; width: 100%; max-width: 420px;
  transform: translateY(8px); transition: transform 0.2s ease;
}
.celena-modal-overlay.is-visible .celena-modal { transform: translateY(0); }
.celena-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.celena-modal-icon {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.celena-modal-icon.info    { background: var(--accent-soft); color: var(--accent); }
.celena-modal-icon.success { background: rgba(16,185,129,.14); color: var(--success); }
.celena-modal-icon.error   { background: rgba(239,68,68,.14); color: var(--danger); }
.celena-modal-icon.warning { background: rgba(245,158,11,.16); color: var(--warning); }
.celena-modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.celena-modal-msg { font-size: 14px; color: var(--text); line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.celena-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
/* Поле ввода в Celena.prompt — растягивается на ширину модала, унифицированный border. */
.celena-modal-input { margin-top: 12px; }
.celena-modal-input input,
.celena-modal-input textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.celena-modal-input input:focus,
.celena-modal-input textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.celena-modal-err {
  font-size: 12px; color: var(--danger); margin-top: 6px;
  min-height: 16px;
}
/* Красная primary-кнопка для деструктивных подтверждений (удаление). */
.btn-danger-solid {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* Notifications */
.notif { position: relative; display: inline-block; }
.notif-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease; position: relative; padding: 0;
}
.notif-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.notif-ico { line-height: 1; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: var(--shadow-soft-lg, 0 10px 32px rgba(0,0,0,0.16));
  z-index: 40; overflow: hidden;
}
.notif-panel[hidden] { display: none; }
.notif-head {
  padding: 10px 12px 10px 16px; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--border-soft); color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.notif-clear {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: 0; cursor: pointer; white-space: nowrap;
  color: var(--accent); font-size: 12px; font-weight: 500;
  padding: 4px 6px; border-radius: 6px;
}
.notif-clear:hover { background: var(--accent-soft); }
.notif-clear[hidden] { display: none; }
.notif-empty { padding: 24px 16px; color: var(--text-muted); text-align: center; font-size: 13px; }
.notif-empty[hidden] { display: none; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.notif-item { position: relative; border-bottom: 1px solid var(--border-soft); }
.notif-item:last-child { border-bottom: 0; }
.notif-item[hidden] { display: none; }
.notif-item > .notif-link { display: block; padding: 12px 42px 12px 16px; text-decoration: none; color: var(--text); }
.notif-item > a.notif-link:hover { background: var(--surface-2); text-decoration: none; }
/* Непрочитанные выделяем: акцентная полоса слева, жирный заголовок и точка-маркер. */
.notif-item.is-unread::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.notif-item.is-unread .notif-title { font-weight: 700; }
.notif-item.is-unread .notif-title::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px;
  border-radius: 50%; background: var(--accent); vertical-align: middle;
}
.notif-title { font-weight: 500; font-size: 13px; margin-bottom: 2px; }
.notif-text { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.notif-time { font-size: 11px; }
/* Кнопка «прочитано» (галочка) у каждого уведомления. */
.notif-read {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--text-muted); transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.notif-read:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
/* Футер мини-панели — ссылка на страницу «Все уведомления». */
.notif-all {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--accent); text-decoration: none;
  border-top: 1px solid var(--border-soft);
}
.notif-all:hover { background: var(--accent-soft); text-decoration: none; }
.notif-all svg { width: 14px; height: 14px; }

/* ==== Страница «Все уведомления» (/admin/notifications) ==== */
.notif-page { max-width: 760px; }
/* Фильтры страницы — chip-кнопки (класс .tabs-btn вне .form-tabs не оформлен, задаём свой вид). */
.notif-page-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; padding: 0; border: 0; }
.notif-page-filters .tabs-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); padding: 7px 15px; border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.notif-page-filters .tabs-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.notif-page-filters .tabs-btn.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.notif-page-list {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}
.notif-page-item { display: flex; align-items: stretch; }
.notif-page-item > .notif-link { flex: 1 1 auto; padding: 14px 16px; }
.notif-page-item .notif-title { font-size: 14px; }
.notif-page-item .notif-text { font-size: 13px; }
/* Прочитанные приглушаем только в части контента — кнопка остаётся чёткой. */
.notif-page-item.is-read > .notif-link { opacity: 0.55; }
.notif-page-item.is-read .notif-title { font-weight: 500; }
/* Кнопка-переключатель прочитано/непрочитано — в духе прочих icon-кнопок админки:
   спокойный контур в покое, мягкая акцентная подсветка вместо кричащей заливки. */
.notif-toggle-read {
  flex: 0 0 auto; align-self: center; margin: 0 14px 0 6px;
  width: 30px; height: 30px; border-radius: 50%; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.notif-toggle-read:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
/* Прочитано: мягкая акцентная заливка (как активные пункты меню/чипы темы). */
.notif-page-item.is-read .notif-toggle-read { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.notif-page-empty { margin-top: 8px; }

/* Mobile hamburger (hidden on desktop) */
.mobile-toggle {
  display: none;
  background: transparent; border: 0;
  width: 36px; height: 36px; cursor: pointer;
  color: var(--text); font-size: 20px;
  margin-right: 8px;
}

.page { padding: 24px; max-width: 1400px; width: 100%; box-sizing: border-box; }

/* ============================================================
   Page headers
   ============================================================ */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin: 0 0 24px; gap: 16px; flex-wrap: wrap;
}
.page-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p.muted { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Компактный вариант для страниц редактирования: когда под заголовком есть
   ссылка "← К списку" — уменьшаем заголовок, переносим ссылку ВЫШЕ h1,
   суммарно экономим ~20px вертикали. */
.page-head:has(p.muted a) { margin-bottom: 14px; }
.page-head:has(p.muted a) > div:first-child {
  display: flex; flex-direction: column-reverse; gap: 2px;
}
.page-head:has(p.muted a) h1 {
  margin: 0; font-size: 18px; font-weight: 600; letter-spacing: 0;
}

/* Однострочная компактная шапка: title + бейдж-счётчик + actions в одну линию.
   Используется на index-страницах (orders, customers и т.п.). */
.page-head-compact { align-items: center; margin-bottom: 14px; gap: 12px; }
.page-head-compact > h1 {
  margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 10px;
  flex: 1 1 auto; min-width: 0;
}
.page-head-count {
  background: var(--surface-2); color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px;
  letter-spacing: 0;
}
.page-head:has(p.muted a) > div:first-child > p.muted { font-size: 12px; }
.page-head:has(p.muted a) > div:first-child > p.muted a { color: var(--text-muted); text-decoration: none; }
.page-head:has(p.muted a) > div:first-child > p.muted a:hover { color: var(--accent); }

.muted { color: var(--text-muted); }

/* ============================================================
   Cards & metrics
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}
.card h3 { margin-top: 0; font-weight: 600; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.metric {
  position: relative;
  padding: 22px 22px 20px;
  border-radius: var(--radius);
  color: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.metric:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12); }
.metric::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,0.22), transparent 60%);
  pointer-events: none;
}
.metric-label { font-size: 13px; opacity: 0.92; margin-bottom: 10px; font-weight: 500; }
.metric-value { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.metric-ico {
  position: absolute; top: 18px; right: 18px;
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; backdrop-filter: blur(4px);
}
.metric-violet { background: linear-gradient(135deg, #7c5cff 0%, #9f7bff 100%); }
.metric-green  { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); }
.metric-orange { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
.metric-pink   { background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%); }
.metric-blue   { background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%); }
.metric-red    { background: linear-gradient(135deg, #ef4444 0%, #f87171 100%); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: rgba(16,185,129,.10); color: var(--success); border-color: rgba(16,185,129,.2); }
.flash-error   { background: rgba(239,68,68,.08);  color: var(--danger);  border-color: rgba(239,68,68,.2); }
.flash-warning { background: rgba(245,158,11,.08); color: var(--warning); border-color: rgba(245,158,11,.2); }
.flash-info    { background: var(--accent-soft);   color: var(--accent);  border-color: rgba(109,92,255,.2); }

/* ============================================================
   Tables
   ============================================================ */
.table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border-soft); font-size: 14px; vertical-align: middle; }
.table th { background: var(--surface-2); color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .row-link { color: var(--text); font-weight: 500; text-decoration: none; }
.table .row-link:hover { color: var(--accent); text-decoration: none; }
.table .actions a, .table .actions button { margin-left: 10px; font-size: 13px; color: var(--text-muted); background: transparent; border: 0; cursor: pointer; padding: 0; }
.table .actions a:hover, .table .actions button:hover { color: var(--accent); }
.table .actions .danger:hover { color: var(--danger); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.badge-published { background: rgba(16,185,129,.12); color: var(--success); }
.badge-draft    { background: rgba(245,158,11,.14); color: var(--warning); }

.cat-chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--accent-soft); color: var(--accent);
  text-decoration: none; border: 1px solid transparent;
}
.cat-chip:hover { background: var(--accent); color: var(--accent-contrast); text-decoration: none; }
.badge-pending  { background: rgba(245,158,11,.14); color: var(--warning); }
.badge-approved { background: rgba(16,185,129,.12); color: var(--success); }
.badge-spam     { background: rgba(239,68,68,.10);  color: var(--danger); }
.badge-trash    { background: var(--surface-2);     color: var(--text-muted); }
.badge-admin    { background: linear-gradient(135deg, #6d5cff, #8b7bff); color: #fff; }
.badge-editor   { background: var(--accent-soft); color: var(--accent); }
.badge-author   { background: rgba(16,185,129,.12); color: var(--success); }
.badge-user     { background: var(--surface-2); color: var(--text-muted); }
.badge-new      { background: rgba(59,130,246,.12); color: var(--info); }
.badge-paid     { background: rgba(16,185,129,.12); color: var(--success); }
.badge-shipped  { background: var(--accent-soft);   color: var(--accent); }
.badge-delivered{ background: rgba(16,185,129,.16); color: var(--success); }
.badge-cancelled{ background: rgba(239,68,68,.10);  color: var(--danger); }

/* ============================================================
   Forms
   ============================================================ */
.form {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  max-width: 920px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-muted); margin-bottom: 6px;
}
.form-group label.checkbox { display: inline-flex; align-items: center; gap: 10px; color: var(--text); margin-bottom: 0; font-weight: 400; cursor: pointer; user-select: none; }

/* Красивые чекбоксы везде в админке.
   Работают с любым <input type="checkbox"> — в label.checkbox, в таблицах, формах и т.д. */
body.admin input[type="checkbox"]:not(.no-style) {
  -webkit-appearance: none; appearance: none; -moz-appearance: none;
  width: 18px; height: 18px; flex-shrink: 0;
  margin: 0; padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer; position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  vertical-align: middle;
}
body.admin input[type="checkbox"]:not(.no-style):hover {
  border-color: var(--accent);
}
body.admin input[type="checkbox"]:not(.no-style):checked {
  background: var(--accent); border-color: var(--accent);
}
body.admin input[type="checkbox"]:not(.no-style):checked::after {
  content: ""; position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
body.admin input[type="checkbox"]:not(.no-style):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
body.admin input[type="checkbox"]:not(.no-style):disabled {
  opacity: 0.5; cursor: not-allowed;
}
body.admin input[type="checkbox"]:not(.no-style):indeterminate {
  background: var(--accent); border-color: var(--accent);
}
body.admin input[type="checkbox"]:not(.no-style):indeterminate::after {
  content: ""; position: absolute;
  left: 3px; right: 3px; top: 50%; height: 2px;
  background: #fff; transform: translateY(-50%);
  border: 0;
}

/* Красивый file-input: dashed-зона + кнопка "Выбрать" */
body.admin input[type="file"]:not(.no-style) {
  display: block; width: 100%;
  padding: 0;
  font-size: 13px; color: var(--text); font-family: inherit;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  overflow: hidden;
}
body.admin input[type="file"]:not(.no-style):hover {
  border-color: var(--accent); background: var(--accent-soft);
}
body.admin input[type="file"]:not(.no-style):focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
body.admin input[type="file"]:not(.no-style)::file-selector-button {
  padding: 10px 18px; margin-right: 14px;
  border: 0; border-right: 1px solid var(--border);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  font-weight: 500; font-size: 13px; font-family: inherit;
  border-radius: 0; cursor: pointer;
  transition: filter 0.15s ease;
}
body.admin input[type="file"]:not(.no-style)::file-selector-button:hover {
  filter: brightness(1.05);
}

/* Радиокнопки в том же стиле */
body.admin input[type="radio"]:not(.no-style) {
  -webkit-appearance: none; appearance: none; -moz-appearance: none;
  width: 18px; height: 18px; flex-shrink: 0;
  margin: 0; padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer; position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  vertical-align: middle;
}
body.admin input[type="radio"]:not(.no-style):hover { border-color: var(--accent); }
body.admin input[type="radio"]:not(.no-style):checked { border-color: var(--accent); }
body.admin input[type="radio"]:not(.no-style):checked::after {
  content: ""; position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
}
body.admin input[type="radio"]:not(.no-style):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="time"],
.form-group input[type="search"],
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group textarea { resize: vertical; min-height: 140px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group .help { display: block; margin-top: 6px; color: var(--text-muted); font-size: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* Input + кнопка справа от инпута (генератор кода и т.п.) */
.input-group { display: flex; gap: 0; }
.input-group > input { flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-btn {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  margin-left: -1px; padding: 0 14px; white-space: nowrap;
}

/* Логическая группа полей (срок действия, секции с заголовком) */
.form-fieldset {
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 12px 16px 4px; margin: 0 0 16px; background: var(--surface-2);
}
.form-fieldset > legend {
  padding: 0 8px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px;
}

.card > .form,
.card .form {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  max-width: none;
}

/* Tabs */
.form-tabs .tabs-nav {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  margin: 0 0 20px;
  padding: 0;
}
.form-tabs .tabs-btn {
  background: transparent; border: 0; padding: 10px 14px;
  font-size: 14px; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; font-family: inherit;
}
.form-tabs .tabs-btn:hover { color: var(--text); }
.form-tabs .tabs-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.form-tabs .tabs-pane { display: none; }
.form-tabs .tabs-pane.active { display: block; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 0; text-decoration: none; font-family: inherit;
  transition: all 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-2); box-shadow: 0 4px 14px rgba(109, 92, 255, 0.35); text-decoration: none; }
/* Убираем системную обводку при клике; для клавиатуры — аккуратный ring в стиле темы. */
.btn-primary:focus,
.btn-secondary:focus { outline: none; }
.btn-primary:focus-visible,
.btn-secondary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-3); text-decoration: none; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; text-decoration: none; }

/* AI */
.ai-btn {
  background: linear-gradient(135deg, #6d5cff, #8b7bff);
  color: #fff; border: 0; padding: 5px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
  cursor: pointer; margin-left: 8px; vertical-align: middle;
  box-shadow: 0 2px 8px rgba(109, 92, 255, 0.3);
}
.ai-btn:hover { background: linear-gradient(135deg, #8b7bff, #a190ff); box-shadow: 0 4px 14px rgba(109, 92, 255, 0.4); }
.ai-btn:disabled { opacity: 0.6; cursor: wait; }

/* ============================================================
   celenaEditor — force horizontal toolbar
   ============================================================ */
body.admin #celenaEditorToolbar,
body.admin .celenaEditorToolbar,
body.admin textarea + #celenaEditorToolbar,
body.admin textarea + .celenaEditorToolbar {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
  padding: 8px 10px !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  box-shadow: none !important;
  align-items: center !important;
  grid-template-columns: none !important;
  grid-template-rows: none !important;
  grid-auto-flow: unset !important;
  backdrop-filter: none !important;
  color: var(--text) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  justify-content: flex-start !important;
}
body.admin .celenaEditor {
  min-height: 420px !important;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 16px 18px;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.65;
  outline: none; overflow-y: auto; max-height: 700px;
}
body.admin .celenaEditor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
body.admin .celenaEditor p { margin: 0 0 0.8em; }
body.admin .celenaEditor h1 { font-size: 1.8em; }
body.admin .celenaEditor h2 { font-size: 1.4em; }
body.admin .celenaEditor h3 { font-size: 1.2em; }
body.admin .celenaEditor img { max-width: 100%; height: auto; border-radius: 8px; }
body.admin .celenaEditor ul, body.admin .celenaEditor ol { padding-left: 1.6em; }
body.admin .celenaEditor blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-muted); margin-left: 0; }
body.admin .celenaEditor a { color: var(--accent); }
body.admin .celenaEditor pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; }

body.admin #celenaEditorToolbar button, body.admin .celenaEditorToolbar button {
  background: transparent !important;
  width: 32px !important; height: 32px !important;
  border: 1px solid transparent !important;
  padding: 0 !important; border-radius: 8px !important;
}
body.admin #celenaEditorToolbar button:hover, body.admin #celenaEditorToolbar button.active,
body.admin .celenaEditorToolbar button:hover, body.admin .celenaEditorToolbar button.active {
  background: var(--surface-2) !important; border-color: var(--border) !important;
}
body.admin #celenaEditorToolbar button svg, body.admin .celenaEditorToolbar button svg {
  width: 18px !important; height: 18px !important; padding: 0 !important;
  fill: var(--text-muted) !important; opacity: 1 !important;
}
body.admin #celenaEditorToolbar button:hover svg, body.admin #celenaEditorToolbar button.active svg,
body.admin .celenaEditorToolbar button:hover svg, body.admin .celenaEditorToolbar button.active svg { fill: var(--accent) !important; }
body.admin #celenaEditorToolbar select, body.admin .celenaEditorToolbar select {
  height: 32px !important;
  border: 1px solid var(--border) !important;
  background-color: var(--bg) !important;
  color: var(--text) !important;
  padding: 4px 18px 4px 8px !important;
  font-size: 13px !important;
  min-width: 60px !important; width: auto !important;
  border-radius: 6px !important;
}

/* ============================================================
   Media picker field
   ============================================================ */
.media-field { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.media-field input[type="url"], .media-field input[type="text"] { flex: 1; min-width: 200px; }
.media-field .media-preview {
  width: 80px; height: 80px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px;
}
.media-field .media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-field .media-pick-btn {
  padding: 10px 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.media-field .media-pick-btn:hover { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

/* Modal (media picker) */
.cm-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.cm-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); }
.cm-dialog {
  position: relative; background: var(--surface);
  border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0,0,0,.3);
  width: 92%; max-width: 900px; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.cm-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--border-soft); }
.cm-head h3 { margin: 0; font-size: 16px; }
.cm-close { background: transparent; border: 0; font-size: 24px; color: var(--text-muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; }
.cm-close:hover { background: var(--surface-2); color: var(--danger); }
.cm-tabs { display: flex; border-bottom: 1px solid var(--border-soft); padding: 0 22px; }
.cm-tab { background: transparent; border: 0; padding: 12px 16px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit; font-size: 14px; }
.cm-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.cm-body { padding: 18px 22px; overflow-y: auto; }
.cm-loading { text-align: center; padding: 40px; color: var(--text-muted); }
.cm-pane { display: none; }
.cm-pane.active { display: block; }
.cm-actions { display: flex; justify-content: flex-end; padding: 12px 22px; border-top: 1px solid var(--border-soft); gap: 8px; }
.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.cm-cell { background: var(--surface-2); border: 2px solid transparent; border-radius: var(--radius-sm); padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.cm-cell:hover { border-color: var(--accent); }
.cm-cell.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cm-cell.selected::before { content: "✓"; position: absolute; top: 6px; right: 6px; background: var(--accent); color: #fff; width: 22px; height: 22px; border-radius: 50%; font-size: 13px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.cm-cell img { width: 100%; height: 110px; object-fit: cover; display: block; }
.cm-cell span { padding: 4px 8px; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-drop { display: block; padding: 40px; border: 2px dashed var(--border); border-radius: var(--radius-sm); text-align: center; color: var(--text-muted); cursor: pointer; }
.cm-drop:hover { border-color: var(--accent); color: var(--accent); }
.cm-drop input { display: none; }
.cm-upload-status { margin-top: 12px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { display: flex; gap: 6px; margin-top: 16px; align-items: center; justify-content: center; font-size: 14px; }
.pagination a, .pagination span { padding: 7px 13px; border-radius: var(--radius-sm); color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-size: 13px; }
.pagination a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 500; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state .icon { font-size: 40px; opacity: 0.4; margin-bottom: 14px; }

/* ============================================================
   Auth page (login)
   ============================================================ */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow-soft); }
.auth-brand { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.auth-card h1 { margin: 0 0 20px; font-size: 22px; }
.auth-card label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.auth-card label.checkbox { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--text); }
.auth-card input[type="email"], .auth-card input[type="password"] { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); margin-bottom: 14px; }
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; }
.auth-card .btn-primary { width: 100%; padding: 11px; }
.alert.error { background: rgba(239,68,68,.10); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }

/* ============================================================
   Mobile (<= 900px)
   ============================================================ */
@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  body.admin .sidebar {
    position: fixed;
    top: 0; left: -280px;
    width: 240px; height: 100vh;
    z-index: 200;
    transition: left 0.25s ease;
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.3);
  }
  body.admin.is-mobile-open .sidebar { left: 0; }
  body.admin.is-mobile-open::before {
    content: ""; position: fixed; inset: 0; z-index: 150;
    background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px);
  }
  body.admin .sb-toggle { display: none; }
  .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }
  body.admin.is-collapsed,
  html.is-collapsed body.admin { grid-template-columns: 1fr; }
  body.admin.is-collapsed .sb-text,
  html.is-collapsed body.admin .sb-text { display: flex; }
  body.admin.is-collapsed .sb-brand,
  html.is-collapsed body.admin .sb-brand { justify-content: flex-start; padding: 12px 16px 22px; }
  body.admin.is-collapsed .sb-nav a,
  html.is-collapsed body.admin .sb-nav a { justify-content: flex-start; padding: 9px 12px; }
  body.admin.is-collapsed .sb-nav a .sb-label,
  html.is-collapsed body.admin .sb-nav a .sb-label { display: inline; }
  .topbar { padding: 10px 14px; }
  .topbar .user-name { display: none; }
  .page { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .topbar .lang-dd-btn .lang-dd-code-lg { display: none; }
}
@media (max-width: 500px) {
  .metrics { grid-template-columns: 1fr; }
}

/* ==== Дашборд: пульс CMS, срез контента, секции плагинов ==== */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dash-head h1 { margin: 0 0 4px; font-size: 24px; }
.dash-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.card-h h3 { margin: 0; font-size: 15px; }
.card-h a { font-size: 12px; text-decoration: none; }
.card-h a:hover { color: var(--accent); }

.dash-pulse { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
.pulse-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; overflow: hidden; }
.pulse-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; opacity: 0.18; }
.pulse-tone-a::after { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.pulse-tone-b::after { background: linear-gradient(135deg, #10b981, #34d399); }
.pulse-tone-c::after { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.pulse-tone-d::after { background: linear-gradient(135deg, #ec4899, #f472b6); }
.pulse-ico { width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.pulse-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.pulse-value { font-size: 28px; font-weight: 700; line-height: 1.1; margin: 4px 0; }
.pulse-delta { font-size: 12px; }

.dash-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 22px; }
.content-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.content-cell { display: block; padding: 14px; background: var(--surface-2); border-radius: 10px; text-align: center; text-decoration: none; color: var(--text); transition: transform 0.15s, background 0.15s; }
.content-cell:hover { transform: translateY(-2px); background: var(--accent-soft); }
.content-num { font-size: 22px; font-weight: 700; line-height: 1; }
.content-cap { font-size: 11px; color: var(--text-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

.dash-ok { color: #10b981; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.dash-empty-hint { padding: 24px 8px; text-align: center; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border-soft); text-decoration: none; color: var(--text); }
.todo-row:hover { color: var(--accent); }
.todo-list li:last-child .todo-row { border-bottom: none; }
.todo-ico { color: var(--text-muted); }
.todo-label { flex: 1; font-size: 13px; }
.todo-num { background: var(--accent-soft); color: var(--accent); font-weight: 600; padding: 2px 9px; border-radius: 10px; font-size: 12px; }

.dash-quickstart .qs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.qs-btn { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--surface-2); border-radius: 10px; text-decoration: none; color: var(--text); transition: background 0.15s, transform 0.15s; font-size: 13px; }
.qs-btn:hover { background: var(--accent-soft); color: var(--accent); transform: translateY(-1px); }
.qs-btn svg { color: var(--accent); flex-shrink: 0; }

/* ==== Виджет shop в дашборде ==== */
.dash-shop-block { margin-bottom: 22px; }
.dash-shop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.dash-shop-head h3 { margin: 0 0 4px; font-size: 18px; }
.dash-shop-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dash-shop-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.kpi-rev::before { background: linear-gradient(180deg, #10b981, #34d399); }
.kpi-ord::before { background: linear-gradient(180deg, #6366f1, #8b5cf6); }
.kpi-aov::before { background: linear-gradient(180deg, #f59e0b, #fbbf24); }
.kpi-cli::before { background: linear-gradient(180deg, #ec4899, #f472b6); }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.kpi-value { font-size: 24px; font-weight: 700; margin: 4px 0; line-height: 1.15; }
.kpi-sub { font-size: 12px; }

.dash-shop-row { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 14px; }
/* Бар-чарт работает и в виджете магазина, и на странице аналитики.
 * Ключевое: .chart-bar обязан иметь height:100%, иначе height:X% у внутреннего span
 * считается от auto и схлопывается до min-height — был баг, когда вместо столбиков
 * рисовалась тонкая полоска у нижнего края. */
.chart-bars { display: flex; align-items: flex-end; height: 160px; gap: 3px; padding: 12px 0 4px; border-bottom: 1px solid var(--border-soft); }
.chart-bar { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-width: 6px; }
.chart-bar > span { display: block; width: 100%; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 3px 3px 0 0; min-height: 2px; transition: opacity 0.15s; }
.chart-bar:hover > span { opacity: 0.75; }
.chart-axis { display: flex; gap: 3px; font-size: 10px; margin-top: 6px; }
.chart-axis > span { flex: 1; text-align: center; }

.alerts-list { list-style: none; padding: 0; margin: 0; }
.alert-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border-soft); text-decoration: none; color: var(--text); }
.alerts-list li:last-child .alert-row { border-bottom: none; }
.alert-row:hover { color: var(--accent); }
.alert-row.is-zero { opacity: 0.55; }
.alert-ico { color: var(--text-muted); }
.alert-label { flex: 1; font-size: 13px; }
.alert-num { background: var(--accent-soft); color: var(--accent); font-weight: 600; padding: 2px 9px; border-radius: 10px; font-size: 12px; }
.alert-row.is-zero .alert-num { background: var(--surface-2); color: var(--text-muted); }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.catalog-cell { display: block; padding: 18px 12px; text-align: center; background: var(--surface-2); border-radius: 10px; text-decoration: none; color: var(--text); transition: transform 0.15s, background 0.15s; }
.catalog-cell:hover { transform: translateY(-2px); background: var(--accent-soft); }
.catalog-num { font-size: 26px; font-weight: 700; line-height: 1; }
.catalog-cap { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.hits-list { list-style: none; padding: 0; margin: 0; }
/* Двухколоночный грид: первая — медалька с номером (фиксированная), вторая — текст.
 * Заголовок и мета явно прибиты к колонке 2 (grid-column: 2), иначе мета съезжала
 * на новую строку и попадала в колонку 1, ужимаясь до 28px и переносясь посимвольно. */
.hits-list li { display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; row-gap: 2px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.hits-list li:last-child { border-bottom: none; }
.hits-pos { grid-row: 1 / span 2; align-self: center; width: 26px; height: 26px; background: var(--surface-2); border-radius: 7px; text-align: center; line-height: 26px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.hits-list li:nth-child(1) .hits-pos { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.hits-list li:nth-child(2) .hits-pos { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; }
.hits-list li:nth-child(3) .hits-pos { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }
.hits-title { grid-column: 2; align-self: end; display: block; font-size: 13px; font-weight: 500; text-decoration: none; color: var(--text); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hits-title:hover { color: var(--accent); }
.hits-meta { grid-column: 2; align-self: start; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hits-meta svg { color: #f5b400; vertical-align: -2px; }

.dash-shop-orders code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.dash-empty { text-align: center; padding: 36px 16px; color: var(--text-muted); }
.dash-empty-ico { opacity: 0.35; margin-bottom: 12px; }
.dash-empty p { margin: 6px 0; }

@media (max-width: 1100px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
  .dash-shop-row { grid-template-columns: 1fr; }
}

/* ==== Подсказка-карточка в табах формы ==== */
.hint-card { padding: 14px 16px; border-radius: 10px; margin: 0 0 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.hint-card p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.hint-card p:first-of-type { margin-top: 8px; }
.hint-h { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent); font-size: 13px; }
.hint-card-blue { border-left-color: #6366f1; background: rgba(99, 102, 241, 0.08); }
.hint-card-blue .hint-h { color: #6366f1; }
.hint-card-green { border-left-color: #10b981; background: rgba(16, 185, 129, 0.08); }
.hint-card-green .hint-h { color: #10b981; }
.hint-vs { font-size: 12px; padding-top: 8px; margin-top: 10px; border-top: 1px dashed rgba(0,0,0,0.08); }
[data-theme="dark"] .hint-vs { border-top-color: rgba(255,255,255,0.1); }

/* ==== Атрибуты в форме товара ==== */
.attr-list { display: flex; flex-direction: column; gap: 14px; }
.attr-row { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; padding: 12px 14px; background: var(--surface-2); border-radius: 8px; }
.attr-label { display: flex; flex-direction: column; gap: 4px; line-height: 1.3; padding-top: 8px; }
.attr-title { font-size: 13px; font-weight: 500; color: var(--text); }
.attr-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--accent); }
.attr-row input[type="text"], .attr-row input[type="number"], .attr-row select { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
.attr-multi { display: flex; flex-wrap: wrap; gap: 8px; }
.attr-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 18px; cursor: pointer; font-size: 13px; user-select: none; transition: background 0.15s, border-color 0.15s; background: var(--bg); }
.attr-chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.attr-chip input { accent-color: var(--accent); }
@media (max-width: 700px) {
  .attr-row { grid-template-columns: 1fr; }
}

/* ==== Каталог товаров: фильтры, табы, расширенная таблица ==== */
.prod-filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.prod-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -4px -4px 14px; padding: 0 4px; }
.prod-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; font-size: 14px; }
.prod-tab:hover { color: var(--text); }
.prod-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.prod-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; padding: 0 6px; background: var(--surface-2); border-radius: 9px; font-size: 11px; color: var(--text-muted); }
.prod-tab.is-active .prod-tab-count { background: var(--accent-soft); color: var(--accent); }

.prod-filter-row { display: grid; grid-template-columns: 2fr 1.2fr 1fr 1fr 0.6fr auto; gap: 10px; align-items: center; }
.prod-search { position: relative; }
.prod-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.prod-search input { width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 14px; }
.prod-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.prod-select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 14px; cursor: pointer; }
.prod-select-sm { min-width: 90px; }
.prod-filter-extra-toggle { margin-top: 12px; }
.prod-filter-extra { display: none; margin-top: 12px; padding: 14px; background: var(--surface-2); border-radius: 8px; }
.prod-filter-extra.is-open { display: block; }
.prod-extra-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 2fr; gap: 14px; align-items: end; }
.prod-extra-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-muted); }
.prod-extra-field input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 14px; }
.prod-extra-checks { display: flex; flex-direction: column; gap: 8px; }
.prod-extra-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text); }
.prod-extra-check input[type="checkbox"] { accent-color: var(--accent); }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 9px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.prod-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.prod-table { width: 100%; }
.prod-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.prod-table tbody td { padding: 14px; vertical-align: middle; border-bottom: 1px solid var(--border-soft); }
.prod-table tbody tr:hover { background: var(--surface-2); }
.prod-table .th-name { width: 36%; }
.prod-table .th-fav, .prod-table .td-fav { width: 36px; text-align: center; }
.prod-table .th-actions, .prod-table .td-actions { width: 48px; text-align: center; white-space: nowrap; }
.prod-table .actions { text-align: right; white-space: nowrap; }

.prod-cell-name { display: flex; gap: 12px; align-items: center; }
.prod-thumb { position: relative; width: 56px; height: 56px; border-radius: 8px; background: var(--surface-2); overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prod-thumb-empty { color: var(--text-muted); }
.prod-thumb-extra { position: absolute; right: 2px; bottom: 2px; padding: 1px 5px; background: rgba(0,0,0,0.65); color: #fff; font-size: 10px; border-radius: 4px; }
.prod-cell-meta { min-width: 0; flex: 1; }
.prod-title { display: block; color: var(--text); font-weight: 600; text-decoration: none; line-height: 1.3; margin-bottom: 4px; }
.prod-title:hover { color: var(--accent); }
.prod-cell-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 11px; color: var(--text-muted); }
.prod-slug { color: var(--text-muted); font-family: ui-monospace, monospace; font-size: 11px; }
.prod-chip-cat { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; font-size: 11px; }

.prod-badge { display: inline-block; padding: 3px 7px; border-radius: 5px; font-size: 11px; font-family: ui-monospace, monospace; margin-right: 4px; }
.prod-badge-id { background: var(--surface-2); color: var(--text-muted); }
.prod-badge-sku { background: #fff7d6; color: #8a6d00; }
[data-theme="dark"] .prod-badge-sku { background: #4a3e10; color: #ffd866; }
.prod-barcode { margin-top: 4px; padding: 2px 6px; display: inline-block; background: #fff7d6; color: #8a6d00; font-family: ui-monospace, monospace; font-size: 10px; border-radius: 3px; }
[data-theme="dark"] .prod-barcode { background: #4a3e10; color: #ffd866; }

/* Колонка цены: вертикальный стек, прибит к правому краю.
 * old_price — мелкая зачёркнутая (если есть), price — крупная,
 * скидка — пилюля под ценой. Все строки выровнены по правому краю,
 * чтобы числа в колонке шли в одну вертикальную линию. */
.prod-table .th-price, .prod-table .td-price { width: 150px; text-align: right; padding-right: 16px; white-space: nowrap; }
.prod-price-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.15; }
.prod-price-old { font-size: 11px; color: var(--text-muted); text-decoration: line-through; }
.prod-price-now { font-weight: 600; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.prod-discount-badge { display: inline-flex; align-items: center; padding: 1px 7px; margin-top: 2px; background: #fce4e4; color: #c62828; border-radius: 10px; font-size: 10px; font-weight: 700; line-height: 1.5; letter-spacing: 0.02em; }
[data-theme="dark"] .prod-discount-badge { background: #4a1e1e; color: #ff8a80; }

/* Колонка просмотров. Клик по числу = открыть товар на сайте. */
.prod-table .th-views, .prod-table .td-views { width: 90px; text-align: center; }
.prod-views { display: inline-block; min-width: 32px; padding: 4px 10px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-variant-numeric: tabular-nums; font-size: 13px; transition: background 0.15s, color 0.15s; }
.prod-views:hover { background: var(--accent-soft); color: var(--accent); }
.td-stock { text-align: center; font-variant-numeric: tabular-nums; }

.prod-fav-btn { background: transparent; border: none; cursor: pointer; padding: 4px; color: var(--border); display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; transition: color 0.15s, background 0.15s; }
.prod-fav-btn:hover { background: var(--surface-2); color: #f5b400; }
.prod-fav-btn.is-on { color: #f5b400; }
.prod-fav-btn.is-on svg { fill: currentColor; }

.prod-rating { font-weight: 600; color: var(--text); white-space: nowrap; }
.prod-row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

/* Колонка действий — компактная, без sticky/тени (после редизайна там одна кнопка). */
.prod-table .td-actions { padding: 14px 8px; }

.row-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer; text-decoration: none; }
.row-icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.row-icon-danger:hover { color: #c62828; border-color: #c62828; background: #fce4e4; }
[data-theme="dark"] .row-icon-danger:hover { background: #4a1e1e; }

@media (max-width: 1100px) {
  .prod-filter-row { grid-template-columns: 1fr 1fr; }
  .prod-extra-grid { grid-template-columns: 1fr 1fr; }
  .prod-table .th-brand, .prod-table .td-brand { display: none; }
}
@media (max-width: 700px) {
  .prod-filter-row { grid-template-columns: 1fr; }
  .prod-extra-grid { grid-template-columns: 1fr; }
}

/* === Заказы магазина: список, карточка, ручное создание ============== */

/* Тулбар фильтров на index-страницах (Orders, Customers и др.).
   Объединяет поиск, селекты и кнопки в одну линию с общими отступами.
   Поля стилизованы как .form-group input — иначе браузер рисует нативные. */
.filters-bar { margin: 0 0 16px; }
.filters-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters-form input[type="search"],
.filters-form input[type="text"],
.filters-form input[type="email"],
.filters-form input[type="number"],
.filters-form input[type="date"],
.filters-form select {
  min-width: 240px;
  padding: 9px 12px;
  font: inherit; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.filters-form input:focus,
.filters-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* Поиск с иконкой слева — добавляем «лапку» через background-image. */
.filters-form input[type="search"] {
  padding-left: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.35-4.35'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 16px 16px;
}
.filters-form select { min-width: 180px; padding-right: 32px; }
.filters-form .btn { padding: 9px 14px; }
.filters-form .btn-link { padding-left: 4px; padding-right: 4px; }
.filters-form .filters-spacer { flex: 1 1 auto; }
/* Когда .tabs-bar идёт сразу за .filters-bar — обнуляем верхний отступ,
   чтобы они читались как единый блок. */
.filters-bar + .tabs-bar { margin-top: -8px; }

.tabs-bar { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tabs-bar .tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 500; transition: color .15s, border-color .15s; }
.tabs-bar .tab:hover { color: var(--text); }
.tabs-bar .tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs-bar .tab-count { background: var(--surface-2); color: var(--text-muted); padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tabs-bar .tab.is-active .tab-count { background: var(--accent-soft); color: var(--accent); }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tab-dot-new       { background: #3b82f6; }
.tab-dot-paid      { background: #10b981; }
.tab-dot-shipped   { background: #f59e0b; }
.tab-dot-delivered { background: #6366f1; }
.tab-dot-cancelled { background: #94a3b8; }
.tab-dot-pending   { background: var(--warning); }
.tab-dot-approved  { background: var(--success); }
.tab-dot-spam      { background: var(--danger); }

/* Комментарии: контекстные кнопки одобрить/спам, горизонтальный layout. */
.cmt-author { font-weight: 500; color: var(--text); }
.cmt-body-cell { max-width: 480px; line-height: 1.5; }
.cmt-actions { white-space: nowrap; }
.cmt-actions .cmt-act { display: inline-block; margin-right: 4px; }
.cmt-actions .cmt-act:last-child { margin-right: 0; }
.cmt-actions .btn { display: inline-flex; align-items: center; gap: 4px; }
.cmt-row-spam .cmt-body-cell,
.cmt-row-spam .cmt-author { opacity: 0.6; }

.pay-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: lowercase; letter-spacing: .02em; }
.pay-pending   { background: rgba(245,158,11,.14); color: #d97706; }
.pay-paid      { background: rgba(16,185,129,.14); color: #059669; }
.pay-refunded  { background: rgba(99,102,241,.14); color: #4f46e5; }
.pay-cancelled { background: rgba(148,163,184,.18); color: #64748b; }

.src-badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); color: var(--text-muted); }
.src-admin { background: rgba(99,102,241,.14); color: #4f46e5; }
.src-web   { background: rgba(16,185,129,.14); color: #059669; }
.src-phone { background: rgba(245,158,11,.14); color: #d97706; }

.table-orders code.ord-num { font-size: 12px; font-weight: 700; color: var(--text); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.table-orders .ord-cust-name { font-weight: 500; color: var(--text); }

/* Карточка заказа: 2-колоночный layout */
.order-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-head code.ord-num { background: var(--surface-2); padding: 4px 10px; border-radius: 6px; font-size: 18px; font-weight: 700; }
.order-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 16px; align-items: start; }
.order-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.order-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }

.card-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); margin: -16px -16px 16px; }
.card-h h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

.table-order-items { width: 100%; }
.table-order-items .oi-title { font-weight: 500; color: var(--text); }

.order-totals { padding: 12px 0 0; border-top: 1px solid var(--border); margin-top: 12px; }
.order-totals .ot-row { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text-muted); }
.order-totals .ot-row.ot-discount { color: #d97706; }
.order-totals .ot-row.ot-total { font-size: 18px; font-weight: 700; color: var(--text); border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 12px; }

.ord-card-status .btn-block { width: 100%; margin-top: 8px; }
.ord-card-status hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.ord-card-status h4 { margin: 0 0 8px; font-size: 13px; }
.ord-stamp { margin: 6px 0 0; font-size: 12px; }

.ord-card-customer .ord-link { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.ord-card-customer .ord-link:hover { color: var(--accent); }
.ord-card-customer hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.cust-stats-mini { display: flex; gap: 12px; flex-wrap: wrap; }
.cust-stats-mini > div { background: var(--surface-2); padding: 8px 12px; border-radius: 8px; flex: 1 1 0; min-width: 0; }
.cust-stats-mini b { display: block; font-size: 16px; }
.cust-stats-mini small { color: var(--text-muted); font-size: 11px; }
.cust-vip-mini { background: linear-gradient(135deg,#fbbf24,#f59e0b); color: #fff; font-weight: 700; flex: 0 0 auto !important; min-width: 50px; text-align: center; padding: 12px 14px !important; }

/* Лента истории */
.ord-note-form { background: var(--surface-2); padding: 12px; border-radius: 8px; margin-bottom: 16px; }
.ord-note-form textarea { background: var(--surface); }
.ord-timeline { list-style: none; margin: 0; padding: 0; }
.ord-tl-item { position: relative; padding: 0 0 16px 24px; border-left: 2px solid var(--border); margin-left: 6px; }
.ord-tl-item:last-child { padding-bottom: 0; border-color: transparent; }
.ord-tl-dot { position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; background: var(--surface); border: 2px solid var(--border); border-radius: 50%; }
.ord-tl-status_changed .ord-tl-dot { border-color: var(--accent); }
.ord-tl-payment_changed .ord-tl-dot { border-color: #10b981; }
.ord-tl-created .ord-tl-dot { border-color: #6366f1; }
.ord-tl-note .ord-tl-dot { border-color: #f59e0b; }
.ord-tl-head { font-size: 13px; }
.ord-tl-text { background: var(--surface-2); padding: 8px 12px; border-radius: 6px; margin: 6px 0 4px; color: var(--text); font-size: 13px; }
.ord-tl-meta { font-size: 11px; }

/* Ручное создание заказа */
.order-create-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 16px; align-items: start; }
.oc-col-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.oc-col-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.oc-col-side .form-actions { display: flex; flex-direction: column; gap: 8px; }
.oc-col-side .btn-block { width: 100%; }

.autocomplete { position: relative; }
.autocomplete-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.08); max-height: 320px; overflow-y: auto; z-index: 30; }
.autocomplete-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--accent-soft); }
.ac-item-title { font-weight: 500; color: var(--text); }
.ac-item-meta { font-size: 11px; }

.text-center { text-align: center; }
.mt-4 { margin-top: 4px; }

@media (max-width: 1100px) {
  .order-grid, .order-create-grid { grid-template-columns: 1fr; }
  .order-side, .oc-col-side { position: static; }
}

/* === Клиенты ========================================================= */

.cust-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,var(--accent),#6366f1); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.cust-avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.cust-name { font-weight: 500; color: var(--text); display: inline-flex; gap: 6px; align-items: center; }
.cust-vip-tag { display: inline-block; background: linear-gradient(135deg,#fbbf24,#f59e0b); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 4px; }

.cust-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 0 0 20px; }
.cust-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.cust-stat-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 4px; }
.cust-stat-value { display: block; font-size: 22px; font-weight: 700; color: var(--text); }

.cust-delete-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.btn-danger { color: #c62828; }

@media (max-width: 900px) {
  .cust-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* === Меню сайта: справка и сниппет ============================================== */

.menu-help { margin: 0 0 20px; padding: 18px 20px; background: var(--accent-soft); border: 1px solid var(--accent); border-left-width: 4px; }
.menu-help h3 { margin: 0 0 10px; font-size: 15px; }

/* Спойлер документации: <details class="docs-spoiler"><summary>...</summary><div class="docs-body">...</div></details>
   Свёрнутое состояние — компактная одна строка; раскрытое — обычное содержимое. */
.docs-spoiler { padding: 0; }
.docs-spoiler > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
  user-select: none;
  outline: none;
}
.docs-spoiler > summary::-webkit-details-marker { display: none; }
.docs-spoiler > summary::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: auto;
  opacity: 0.6;
  transition: transform .15s;
}
.docs-spoiler[open] > summary::after { transform: rotate(-135deg); }
.docs-spoiler > summary:hover { background: rgba(0,0,0,0.03); }
.docs-spoiler > .docs-body { padding: 0 18px 18px; }
.docs-spoiler > .docs-body > :first-child { margin-top: 0; }
.menu-help-steps { margin: 0; padding-left: 20px; }
.menu-help-steps li { margin: 6px 0; line-height: 1.5; }
.menu-help-steps code { background: var(--surface); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.menu-help-steps pre { background: var(--surface); border: 1px solid var(--border); padding: 8px 12px; border-radius: 6px; margin: 6px 0; font-size: 12px; overflow-x: auto; }
.menu-help-more { margin-top: 12px; }
.menu-help-more summary { cursor: pointer; color: var(--text-muted); font-size: 13px; user-select: none; }
.menu-help-more ul { margin: 8px 0 0; padding-left: 20px; }
.menu-help-more li { margin: 4px 0; font-size: 13px; }

.menu-snippet { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; margin: 0 0 18px; background: var(--surface-2); border: 1px solid var(--border); }
.menu-snippet-text { flex: 1 1 auto; min-width: 0; }
.menu-snippet pre { margin: 6px 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow-x: auto; font-size: 12px; }
.menu-snippet pre code { background: transparent; padding: 0; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; }
.menu-snippet small { display: block; margin-top: 4px; }

/* === Экспорт товаров =========================================================== */

.export-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 16px; align-items: start; }
.export-main { min-width: 0; }
.export-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.export-side .form-actions { display: flex; flex-direction: column; gap: 8px; }
.export-side .btn-block { width: 100%; }

.export-groups { display: flex; flex-direction: column; gap: 18px; }
.export-group-title { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.export-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.export-col { padding: 4px 0; }

.export-format { display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.radio-card:hover { border-color: var(--accent); }
.radio-card input[type="radio"] { margin-top: 3px; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card-body { display: flex; flex-direction: column; gap: 2px; }
.radio-card-body b { font-size: 13px; }
.radio-card-body small { color: var(--text-muted); font-size: 11px; }

.export-tip { padding: 12px 14px; background: var(--surface-2); border-style: dashed; }
.export-tip code { background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 11px; }

@media (max-width: 1100px) {
  .export-grid { grid-template-columns: 1fr; }
  .export-side { position: static; }
}
