@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Inter', Arial, sans-serif; background: #f5f6f8; color: #333; min-height: 100vh; }
a { color: #1a1a1a; text-decoration: none; }
a:hover { text-decoration: underline; color: #111111; }

/* ── TOP ADMIN MENU ── */
.top-menu {
  background: #fff;
  border-bottom: 1px solid #dde2e6;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  position: relative;
}
.top-menu-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  width: 100%;
}
.top-menu a {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 500;
  color: #2980b9;
  border-right: 1px solid #dde2e6;
  transition: background 0.1s;
}
.top-menu a:first-of-type { border-left: 1px solid #dde2e6; }
.top-menu a:hover { background: #f5f6f8; text-decoration: none; }
.top-menu a.active { color: #222222; font-weight: 600; }
.top-menu .tm-user {
  position: absolute;
  right: 16px;
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-menu .tm-user a { border: none; padding: 0; font-size: 12px; height: auto; color: #2980b9; }

/* ── SITE HEADER ── */
.header {
  background: #fff;
  border-bottom: 1px solid #dde2e6;
}
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 68px;
}
.header__logo img { height: 54px; width: auto; display: block; }

/* ── HERO (main page search band) ── */
.hero {
  background: #1a1a1a;
  padding: 28px 0;
}
.hero .container { display: flex; justify-content: center; }

/* ── SEARCH ── */
.search {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 28px;
  overflow: hidden;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.search__input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 18px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  outline: none;
}
.search__button {
  background: none;
  border: none;
  padding: 0 16px;
  cursor: pointer;
  color: #999;
  font-size: 16px;
  line-height: 1;
}

/* Compact search (inner pages) */
.container_search {
  padding-top: 14px;
  padding-bottom: 10px;
}
.container_search .search {
  max-width: 560px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  border: 1px solid #dde2e6;
}

/* ── BREADCRUMBS ── */
.breadcrumbs { padding: 10px 0 14px; }
.breadcrumbs ul { list-style: none; display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.breadcrumbs ul li { font-size: 13px; color: #999; }
.breadcrumbs ul li::after { content: ' › '; color: #bbb; margin: 0 5px; }
.breadcrumbs ul li:last-child::after { display: none; }
.breadcrumbs ul li a { color: #1a1a1a; font-size: 13px; }
.breadcrumbs ul li a:hover { text-decoration: underline; }

/* ── MAIN CATEGORIES GRID ── */
.categories {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 28px;
  padding: 24px 0 32px;
}

.category { }

.category-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8ebef;
}
.category-header__icon {
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.category-header__icon img { width: 20px; height: 20px; object-fit: contain; }
.category-header__icon .ico-d {
  width: 20px; height: 20px; display: inline-block;
  background: #222222;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M9 4.804A7.968 7.968 0 005.5 4c-1.255 0-2.443.29-3.5.804v10A7.969 7.969 0 015.5 14c1.669 0 3.218.51 4.5 1.385A7.962 7.962 0 0114.5 14c1.255 0 2.443.29 3.5.804v-10A7.968 7.968 0 0014.5 4c-1.255 0-2.443.29-3.5.804V12a1 1 0 11-2 0V4.804z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M9 4.804A7.968 7.968 0 005.5 4c-1.255 0-2.443.29-3.5.804v10A7.969 7.969 0 015.5 14c1.669 0 3.218.51 4.5 1.385A7.962 7.962 0 0114.5 14c1.255 0 2.443.29 3.5.804v-10A7.968 7.968 0 0014.5 4c-1.255 0-2.443.29-3.5.804V12a1 1 0 11-2 0V4.804z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.category-header__name a {
  font-size: 17px;
  font-weight: 400;
  color: #222222;
  line-height: 1.3;
}
.category-header__name a:hover { text-decoration: underline; }

.category > ul { list-style: none; }
.category-article {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 3px 0;
}
.category-article__icon {
  flex-shrink: 0;
  width: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.category-article__icon img { width: 14px; height: 14px; object-fit: contain; }
.category-article__icon .ico-d {
  width: 14px; height: 14px; display: inline-block;
  background: #222222;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat;
}
.category-article__name a {
  font-size: 16px;
  font-weight: 400;
  color: #222222;
  line-height: 1.4;
}
.category-article__name a:hover { text-decoration: underline; }

.category__show-more { padding: 5px 0 0; }
.category__show-more a { font-size: 12px; color: #222222; font-weight: 500; }
.category__show-more a:hover { text-decoration: underline; }

/* ── CATEGORY PAGE ── */
.container_category { padding-top: 0; }
.container_category .categories {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0 0 24px;
}
.container_category .category > ul {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 20px;
}
.container_category .category-article { padding: 4px 0; }

/* ── ARTICLE PAGE ── */
.container_article { padding-bottom: 32px; }
.article {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 28px;
  align-items: start;
}

.article-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8ebef;
  grid-column: 1 / -1;
}
.article-header__icon { flex-shrink: 0; width: 22px; }
.article-header__icon img { width: 22px; height: 22px; object-fit: contain; }
.article-header__icon .ico-d {
  width: 20px; height: 20px; display: inline-block;
  background: #222222;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat;
}
.article-header__name {
  font-size: 20px;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.2px;
  line-height: 1.3;
}

.article-content { display: contents; }
.article-content__text {
  font-size: 14px;
  line-height: 1.75;
  color: #333;
  min-width: 0;
}
.article-content__text h1 { font-size: 18px; font-weight: 700; color: #222; margin: 18px 0 8px; }
.article-content__text h2 { font-size: 16px; font-weight: 700; color: #222; margin: 16px 0 7px; }
.article-content__text h3 { font-size: 14px; font-weight: 700; color: #222; margin: 12px 0 5px; }
.article-content__text p { margin-bottom: 10px; }
.article-content__text ul, .article-content__text ol { padding-left: 22px; margin-bottom: 10px; }
.article-content__text li { margin-bottom: 4px; }
.article-content__text strong { font-weight: 600; }
.article-content__text a { color: #1a1a1a; text-decoration: underline; }
.article-content__text a:hover { color: #111111; }
.article-content__text code { background: #f0f2f5; padding: 2px 5px; border-radius: 3px; font-size: 12px; font-family: 'Courier New', monospace; }
.article-content__text pre { background: #f5f6f8; border: 1px solid #dde2e6; border-radius: 4px; padding: 12px; overflow-x: auto; margin-bottom: 10px; font-size: 12px; }
.article-content__text img { max-width: 100%; border: 1px solid #dde2e6; border-radius: 4px; margin: 8px 0; display: block; }
.article-content__text img[style*="width"] { max-width: 100%; }
.article-content__text .img-wrap { display: inline-block; margin: 6px 0; max-width: 100%; }
.article-content__text .img-wrap .resize-handle,
.article-content__text .img-wrap .img-toolbar { display: none !important; }
.article-content__text blockquote { border-left: 3px solid #222222; padding: 8px 14px; background: #f5f5f5; margin: 10px 0; border-radius: 0 4px 4px 0; color: #444; font-style: italic; }
.article-content__text .note { background: #fffbeb; border-left: 3px solid #f59e0b; padding: 9px 13px; border-radius: 0 4px 4px 0; margin: 10px 0; font-size: 13px; }
.article-content__text table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 13px; }
.article-content__text table th, .article-content__text table td { padding: 7px 10px; border: 1px solid #dde2e6; text-align: left; }
.article-content__text table th { background: #f5f6f8; font-weight: 600; }

/* Article sidebar */
.article-content__sidebar { }
.article-content__sidebar .category { background: #fff; border: 1px solid #dde2e6; border-radius: 6px; overflow: hidden; }
.article-content__sidebar .category ul { list-style: none; }
.article-content__sidebar .category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #e8ebef;
  margin-bottom: 0;
  border-radius: 0;
}
.article-content__sidebar .category-header__name {
  font-size: 13px;
  font-weight: 700;
  color: #222222;
}
.article-content__sidebar .category-article {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 6px 14px;
  border-bottom: 1px solid #f0f2f5;
  transition: background 0.1s;
}
.article-content__sidebar .category-article:last-child { border-bottom: none; }
.article-content__sidebar .category-article:hover { background: #f5f6f8; }
.article-content__sidebar .category-article_is-active { background: #f5f5f5; }
.article-content__sidebar .category-article_is-active .category-article__name a { font-weight: 600; color: #111111; }
.article-content__sidebar .category-article__name a { font-size: 13px; color: #222222; line-height: 1.4; }
.article-content__sidebar .category-article__name a:hover { text-decoration: underline; }

/* ── FOOTER ── */
.footer {
  background: #fff;
  border-top: 1px solid #dde2e6;
  margin-top: 20px;
}
.footer .container {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer__copyright { font-size: 12px; color: #999; }
.footer__copyright a { color: #1a1a1a; font-size: 12px; }

/* ── SEARCH RESULTS ── */
.search-results { padding: 16px 0; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #fff;
  border: 1px solid #dde2e6;
  border-radius: 5px;
  margin-bottom: 6px;
  transition: background 0.1s;
  text-decoration: none;
  color: #333;
}
.search-result-item:hover { background: #f5f5f5; text-decoration: none; }
.search-result-item .res-title { font-size: 13px; font-weight: 500; color: #222222; flex: 1; }
.search-result-item .res-cat { font-size: 12px; color: #999; }
.search-result-item img, .search-result-item .ico-d { width: 14px; height: 14px; flex-shrink: 0; }
.search-result-item .ico-d { display: inline-block; background: #222222; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z' clip-rule='evenodd'/%3E%3C/svg%3E") center/contain no-repeat; }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f5f6f8; }
.login-box { background: #fff; border: 1px solid #dde2e6; border-radius: 8px; padding: 30px; width: 100%; max-width: 360px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo img { height: 50px; width: auto; }
.login-logo p { font-size: 13px; color: #888; margin-top: 6px; }
.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #666; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.form-group input { width: 100%; border: 1px solid #dde2e6; border-radius: 4px; padding: 8px 11px; font-size: 13px; font-family: inherit; color: #333; outline: none; }
.form-group input:focus { border-color: #222222; box-shadow: 0 0 0 2px rgba(34,34,34,0.12); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: all 0.12s; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-teal { background: #333; color: #fff; border-color: #333; }
.btn-teal:hover { background: #111; border-color: #111; }
.btn-primary { background: #2980b9; color: #fff; border-color: #2980b9; }
.btn-primary:hover { background: #1f6a94; }
.btn-secondary { background: #fff; color: #555; border-color: #dde2e6; }
.btn-secondary:hover { border-color: #222222; color: #222222; }
.btn-danger { background: #fdf0ee; color: #c0392b; border-color: #f5c6c0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── ALERTS ── */
.alert { padding: 9px 13px; border-radius: 4px; font-size: 13px; margin-bottom: 13px; border: 1px solid; }
.alert-success { background: #edfaf1; border-color: #a9dfbf; color: #1e8449; }
.alert-danger  { background: #fdf0ee; border-color: #f5c6c0; color: #922b21; }

/* ── ADMIN PAGES ── */
.admin-topbar { background: #fff; border-bottom: 1px solid #dde2e6; padding: 0 24px; height: 48px; display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.admin-topbar h1 { font-size: 16px; font-weight: 700; color: #222; }
.admin-topbar .tb-back { color: #999; font-size: 16px; padding: 4px; border-radius: 3px; }
.admin-topbar .tb-back:hover { background: #f5f6f8; text-decoration: none; }
.admin-topbar .tb-space { flex: 1; }
.admin-topbar .tb-link { font-size: 12px; color: #222222; display: flex; align-items: center; gap: 4px; }

.admin-main { flex: 1; padding: 18px 22px; overflow-y: auto; min-width: 0; background: #f5f6f8; }
.admin-sidebar { width: 280px; flex-shrink: 0; border-left: 1px solid #dde2e6; background: #fff; display: flex; flex-direction: column; }
.admin-sidebar-search { padding: 9px 10px; border-bottom: 1px solid #dde2e6; display: flex; gap: 5px; }
.admin-sidebar-search input { flex: 1; border: 1px solid #dde2e6; border-radius: 3px; padding: 5px 9px; font-size: 12px; font-family: inherit; outline: none; }
.admin-sidebar-search input:focus { border-color: #222222; }
.admin-sidebar-search button { background: #f5f6f8; border: 1px solid #dde2e6; border-radius: 3px; padding: 5px 8px; cursor: pointer; color: #666; font-size: 13px; }
.cat-tree { flex: 1; overflow-y: auto; }
.cat-item { display: flex; align-items: center; padding: 7px 12px; border-bottom: 1px solid #f0f2f5; font-size: 13px; color: #333; cursor: pointer; transition: background 0.1s; gap: 6px; text-decoration: none !important; }
.cat-item:hover { background: #f5f6f8; }
.cat-item.active { background: #f5f5f5; color: #222222; font-weight: 600; border-left: 3px solid #222222; }
.cat-item .cat-name { flex: 1; }
.cat-item .cat-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.1s; }
.cat-item:hover .cat-actions { opacity: 1; }
.cat-item .cat-actions a { font-size: 12px; color: #999; padding: 2px 5px; border-radius: 3px; }
.cat-item .cat-actions a:hover { background: #f5f5f5; color: #222222; text-decoration: none; }
.cat-item .cat-actions .del { color: #c0392b !important; }

.articles-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.search-art { flex: 1; display: flex; align-items: center; background: #fff; border: 1px solid #dde2e6; border-radius: 4px; overflow: hidden; }
.search-art input { flex: 1; border: none; background: transparent; padding: 7px 11px; font-size: 13px; font-family: inherit; outline: none; }
.search-art span { padding: 0 10px; color: #bbb; }

.articles-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #dde2e6; border-radius: 5px; overflow: hidden; }
.articles-table th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #999; border-bottom: 1px solid #dde2e6; background: #f5f6f8; }
.articles-table td { padding: 9px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; font-size: 13px; }
.articles-table tr:last-child td { border-bottom: none; }
.articles-table tr:hover td { background: #fafbfc; }
.articles-table td.art-id { color: #bbb; font-size: 12px; width: 40px; }
.articles-table td.art-title a { color: #333; font-weight: 500; }
.articles-table td.art-title a:hover { color: #222222; text-decoration: none; }
.articles-table td.art-views { color: #888; text-align: center; width: 80px; font-size: 13px; }
.articles-table td.art-actions { width: 80px; text-align: right; }
.btn-edit { background: #222222; color: #fff; border: none; padding: 4px 10px; border-radius: 3px; cursor: pointer; font-size: 12px; font-weight: 600; margin-right: 3px; }
.btn-edit:hover { background: #111111; }
.btn-del { background: #e74c3c; color: #fff; border: none; padding: 4px 10px; border-radius: 3px; cursor: pointer; font-size: 12px; font-weight: 600; }
.btn-del:hover { background: #c0392b; }

/* Editor */
.editor-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.editor-left { background: #fff; border: 1px solid #dde2e6; border-radius: 5px; overflow: hidden; }
.editor-field { padding: 12px 14px; border-bottom: 1px solid #dde2e6; }
.editor-field label { display: block; font-size: 11px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.editor-field input[type=text] { width: 100%; border: 1px solid #dde2e6; border-radius: 4px; padding: 8px 11px; font-size: 14px; font-family: inherit; color: #333; outline: none; }
.editor-field input:focus { border-color: #222222; }
.editor-toolbar { display: flex; gap: 2px; padding: 6px 8px; background: #f5f6f8; border-bottom: 1px solid #dde2e6; flex-wrap: wrap; }
.editor-btn { padding: 3px 8px; border-radius: 3px; border: none; background: transparent; color: #666; font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 500; transition: all 0.1s; }
.editor-btn:hover { background: #f5f5f5; color: #222222; }
.editor-btn.sep { color: #ddd; padding: 0 3px; cursor: default; }
#article-content { min-height: 320px; padding: 14px; font-size: 14px; line-height: 1.75; color: #333; background: #fff; outline: none; border: none; font-family: inherit; word-break: break-word; }
.editor-right { background: #fff; border: 1px solid #dde2e6; border-radius: 5px; overflow: hidden; }
.editor-right-field { padding: 11px 13px; border-bottom: 1px solid #dde2e6; }
.editor-right-field label { font-size: 11px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 7px; }
.editor-right-field select { width: 100%; border: 1px solid #dde2e6; border-radius: 4px; padding: 6px 9px; font-size: 13px; font-family: inherit; color: #333; outline: none; }
.editor-right-field select:focus { border-color: #222222; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 13px; border-bottom: 1px solid #f0f2f5; font-size: 13px; color: #333; background: #fff; }
.toggle { position: relative; width: 34px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 18px; cursor: pointer; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: #222222; }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Settings */
.settings-block { background: #fff; border: 1px solid #dde2e6; border-radius: 5px; overflow: hidden; margin-bottom: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid #f0f2f5; font-size: 13px; color: #333; gap: 14px; }
.setting-row:last-child { border-bottom: none; }
.setting-row label { flex: 1; cursor: pointer; }
.setting-row .counter { display: flex; align-items: center; border: 1px solid #dde2e6; border-radius: 4px; overflow: hidden; }
.setting-row .counter button { background: #f5f6f8; border: none; padding: 4px 9px; cursor: pointer; font-size: 13px; color: #666; }
.setting-row .counter input { width: 38px; text-align: center; border: none; border-left: 1px solid #dde2e6; border-right: 1px solid #dde2e6; padding: 4px 0; font-size: 13px; font-family: inherit; outline: none; }
.setting-row .color-pick { width: 26px; height: 26px; border: 1px solid #dde2e6; border-radius: 3px; cursor: pointer; padding: 2px; }

/* Cat form */
.cat-form { background: #fff; border: 1px solid #dde2e6; border-radius: 5px; overflow: hidden; max-width: 560px; }
.cat-form-row { display: flex; align-items: center; padding: 11px 16px; border-bottom: 1px solid #f0f2f5; gap: 14px; }
.cat-form-row label { width: 150px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: #666; }
.cat-form-row .cat-field { flex: 1; }
.cat-form-row input[type=text], .cat-form-row select { width: 100%; border: 1px solid #dde2e6; border-radius: 4px; padding: 7px 10px; font-size: 13px; font-family: inherit; color: #333; outline: none; }
.cat-form-row input:focus, .cat-form-row select:focus { border-color: #222222; }
.cat-form-save { padding: 11px 16px; display: flex; justify-content: flex-end; }

/* Role badges */
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; border: 1px solid; }
.role-root  { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.role-admin { background: #eff6ff; color: #2980b9; border-color: #bfdbfe; }
.role-agent { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.role-user  { background: #f9fafb; color: #666; border-color: #dde2e6; }
.pin-badge  { font-size: 11px; background: #fffbeb; color: #d97706; border: 1px solid #fde68a; padding: 1px 5px; border-radius: 10px; font-weight: 700; margin-left: 4px; }

/* Table (admin users/roles) */
.card { background: #fff; border: 1px solid #dde2e6; border-radius: 5px; padding: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 7px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #999; border-bottom: 2px solid #dde2e6; background: #f5f6f8; }
td { padding: 9px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* Page wrappers */
.page-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.admin-page-wrap { max-width: 960px; margin: 0 auto; padding: 20px 24px; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: #bbb; }
.empty-state h3 { font-size: 14px; color: #999; }

/* Link/img dialog */
.link-dialog { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.4); align-items: center; justify-content: center; }
.link-dialog.open { display: flex; }
.link-dialog-box { background: #fff; border-radius: 6px; padding: 20px 22px; width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.link-dialog-box h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: #222; }
.link-dialog-box input { width: 100%; border: 1px solid #dde2e6; border-radius: 4px; padding: 7px 11px; font-size: 13px; font-family: inherit; outline: none; margin-bottom: 8px; }
.link-dialog-box input:focus { border-color: #222222; }
.link-dialog-box .ld-label { font-size: 11px; font-weight: 700; color: #888; display: block; margin-bottom: 4px; text-transform: uppercase; }
.link-dialog-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 4px; }

/* Image resize */
.img-wrap { display: inline-block; position: relative; line-height: 0; margin: 6px 0; }
.img-wrap img { display: block; max-width: 100%; }
.img-wrap .resize-handle { position: absolute; width: 9px; height: 9px; background: #222222; border: 2px solid #fff; border-radius: 2px; z-index: 10; }
.img-wrap .resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }
.img-wrap .resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.img-wrap .resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.img-wrap .resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.img-wrap .img-toolbar { position: absolute; top: -28px; left: 0; background: #1e2330; border-radius: 3px; display: flex; gap: 1px; padding: 2px 5px; }
.img-wrap .img-toolbar button { background: none; border: none; color: #ccc; font-size: 11px; cursor: pointer; padding: 2px 4px; border-radius: 2px; }
.img-wrap .img-toolbar button:hover { background: rgba(255,255,255,0.15); color: #fff; }

.paste-indicator { display:none; position:fixed; bottom:18px; right:18px; background:#222222; color:#fff; padding:7px 13px; border-radius:4px; font-size:12px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index:999; }

@media(max-width:1000px){ .categories { grid-template-columns: repeat(3,1fr); } }
@media(max-width:750px){ .categories { grid-template-columns: repeat(2,1fr); } .article { grid-template-columns: 1fr; } .article-header { grid-column: 1; } .article-content { display: block; } .article-content__sidebar { margin-top: 20px; } .container_category .category > ul { grid-template-columns: repeat(2,1fr); } .editor-layout { grid-template-columns: 1fr; } }
@media(max-width:480px){ .categories { grid-template-columns: 1fr; } .container_category .category > ul { grid-template-columns: 1fr; } .container { padding: 0 14px; } }

/* ── DRAG-DROP CATEGORIES ── */
.cat-item[draggable] { cursor: grab; user-select: none; }
.cat-item[draggable]:active { cursor: grabbing; }
.cat-item.drag-over { background: #f5f5f5; border-top: 2px solid #222222; }
.cat-item.dragging { opacity: 0.4; background: #f5f5f5; }
.drag-handle { color: #ccc; font-size: 12px; margin-right: 4px; cursor: grab; flex-shrink: 0; padding: 2px; }
.drag-handle:hover { color: #222222; }
