/* =============================================
   3ERP WIKI — White / Emerald / Gold
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* === Цветовая палитра === */
    --emerald:        #0b5e42;
    --emerald-dark:   #064e3b;
    --emerald-deeper: #04382a;
    --emerald-light:  #eef2f0;
    --emerald-soft:   #f8fcfb;
    --emerald-mid:    #1d7a5c;

    --gold:           #c6a43b;
    --gold-dark:      #a07f2a;
    --gold-light:     #fcf7e8;
    --gold-soft:      #fefdf8;
    --gold-mid:       #e6cc7a;

    --white:    #ffffff;
    --bg:       #f8fafc;
    --bg-soft:  #f1f5f9;
    --bg-card:  #ffffff;

    --text:       #0f172a;
    --text-light: #475569;
    --text-muted: #94a3b8;

    --border:       #eef2f0;
    --border-mid:   #e2e8f0;
    --border-strong:#cbd5e1;

    /* Сайдбар */
    --sidebar-bg:          #ffffff;
    --sidebar-border:      #eef2f0;
    --sidebar-text:        #334155;
    --sidebar-text-muted:  #94a3b8;
    --sidebar-hover:       rgba(11, 94, 66, 0.05);
    --sidebar-hover-text:  var(--emerald-dark);
    --sidebar-active-bg:   rgba(11, 94, 66, 0.08);
    --sidebar-active-text: var(--emerald-deeper);
    --sidebar-active-bar:  var(--emerald);
    --sidebar-section:     var(--gold);
    --sidebar-width:       260px;

    /* Тени */
    --shadow-xs:  0 2px 4px rgba(0,0,0,0.02);
    --shadow-sm:  0 4px 12px rgba(0,0,0,0.04);
    --shadow-md:  0 12px 28px rgba(0,0,0,0.06);
    --shadow-lg:  0 25px 40px -12px rgba(0,0,0,0.12);

    /* UI */
    --radius:    16px;
    --radius-sm: 8px;
    --radius-xs: 3px;
    --transition: all 0.17s ease;
}

/* =============================================
   СБРОС И БАЗОВЫЕ СТИЛИ
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

/* =============================================
   ТИПОГРАФИКА
   ============================================= */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }

h1 {
    font-size: 1.85rem;
    color: #0d1117;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--emerald-light);
}
h2 { font-size: 1.35rem; color: #111827; margin-bottom: 0.9rem; }
h3 { font-size: 1.05rem; color: #1f2937; margin-bottom: 0.7rem; }
h4 { font-size: 0.95rem; color: #374151; margin-bottom: 0.55rem; }

a { color: var(--emerald-dark); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--emerald-deeper); }
p { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; }

/* =============================================
   КНОПКИ
   ============================================= */
button, .btn, input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.55rem 1.1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 40px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
    min-height: 36px;
    white-space: nowrap;
    text-decoration: none;
}
button:hover, .btn:hover, input[type="submit"]:hover {
    background: var(--bg-soft);
    border-color: var(--border-strong);
    color: var(--text);
}

/* Основная — изумруд */
button.primary, .btn-primary {
    background: var(--emerald);
    border-color: var(--emerald-dark);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(11, 94, 66, 0.25);
}
button.primary:hover, .btn-primary:hover {
    background: var(--emerald-mid);
    border-color: var(--emerald-dark);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(11, 94, 66, 0.30);
    transform: translateY(-2px);
}

/* Опасная */
button.danger, .btn-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}
button.danger:hover, .btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

/* Маленькие */
.btn-sm {
    padding: 0.32rem 0.72rem;
    font-size: 0.8rem;
    min-height: 28px;
    box-shadow: none;
    border-radius: var(--radius-xs);
    color: var(--text-light);
    background: var(--bg-soft);
    border-color: var(--border);
}
.btn-sm:hover { background: var(--emerald-soft); border-color: var(--emerald-mid); color: var(--emerald-deeper); }

/* Добавить */
.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.48rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--emerald);
    border: 1px solid var(--emerald-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(5,150,105,0.22);
    text-decoration: none;
}
.btn-add:hover {
    background: var(--emerald-dark);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Кнопка скачивания файла */
a.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff !important;
    background: var(--emerald);
    border: 1px solid var(--emerald-dark);
    border-radius: var(--radius-sm);
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(11, 94, 66, 0.2);
    transition: var(--transition);
    margin: 0.5rem 0;
}
a.btn-download:hover {
    background: var(--emerald-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(11, 94, 66, 0.3);
}
a.btn-download::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
    background-size: cover;
}

/* =============================================
   ИНПУТЫ
   ============================================= */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select, textarea {
    width: 100%;
    padding: 0.65rem 0.875rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    outline: none;
    appearance: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.12);
}

/* =============================================
   LAYOUT
   ============================================= */
body.front { background: var(--bg); }

.layout {
    display: flex;
    min-height: 100vh;
}

/* =============================================
   САЙДБАР
   ============================================= */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--emerald-mid) transparent;
    display: flex;
    flex-direction: column;
}

/* Панель авторизации в сайдбаре */
.auth-sidebar-panel {
    padding: 0.75rem 1rem;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--emerald-mid); border-radius: 4px; }

/* === Шапка сайдбара === */
.sidebar-header {
    padding: 0;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
    background: var(--white);
}

/* Поиск в сайдбаре */
.search-form {
    display: flex;
    align-items: center;
    margin: 0.75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    transition: var(--transition);
}
.search-form:focus-within {
    border-color: var(--emerald);
    background: var(--white);
    box-shadow: 0 0 0 2px rgba(5,150,105,0.12);
}
.search-form input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border: none;
    background: transparent;
    font-size: 0.8125rem;
    color: var(--text);
    outline: none;
    box-shadow: none;
    width: auto;
}
.search-form input::placeholder { color: var(--text-muted); }
.search-form input:focus { box-shadow: none; border: none; }
.search-form button {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    border-radius: 0;
    padding: 0 0.75rem;
    color: var(--text-muted);
    min-height: 32px;
    box-shadow: none;
    font-size: 0.9rem;
    transition: var(--transition);
}
.search-form button:hover {
    color: var(--emerald-dark);
    background: var(--emerald-soft);
    transform: none;
    box-shadow: none;
}

/* === Тело сайдбара === */
.sidebar-body {
    flex: 1;
    padding: 0.25rem 0 2rem;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Секционные заголовки */
.sidebar h3, .sidebar-body h3 {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    margin: 1rem 0 0.25rem 0.75rem;
    padding: 0;
    opacity: 0.85;
}

/* === Закреплённые === */
.pinned { margin-bottom: 0.5rem; }
.pinned ul, .sidebar ul { list-style: none; padding: 0; margin: 0; }
.pinned li { margin: 0; }
.pinned a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.75rem 0.35rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--sidebar-text);
    transition: var(--transition);
    border-left: 2px solid transparent;
    background: transparent;
}
.pinned a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
    border-left-color: var(--emerald-mid);
}
.pinned a svg { color: var(--gold); flex-shrink: 0; }

/* === Дерево навигации === */
.tree-nav { list-style: none; padding: 0; margin: 0; }
.tree-nav > li { margin: 0; }

.tree-nav .tree-item {
    display: flex;
    align-items: stretch;
    padding: 0;
    gap: 0;
}

.tree-nav .tree-item a {
    flex: 1;
    display: block;
    padding: 0.35rem 0.75rem 0.35rem 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--sidebar-text);
    transition: var(--transition);
    border-left: 2px solid transparent;
    background: transparent;
    line-height: 1.45;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tree-nav .tree-item a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
    border-left-color: var(--emerald-mid);
}

/* Активный пункт */
.tree-nav .active > .tree-item > a {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 700;
    border-left-color: var(--sidebar-active-bar);
}

/* Toggle */
.toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    flex-shrink: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    border-left: 2px solid transparent;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    min-height: auto;
    padding: 0;
}
.toggle:hover {
    color: var(--emerald-dark);
    background: var(--emerald-soft);
    transform: none;
    box-shadow: none;
}
.toggle-placeholder {
    display: inline-block;
    width: 24px;
    flex-shrink: 0;
}

/* Вложенные уровни */
.tree-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 1px solid var(--border-mid);
    margin-left: 0.75rem;
}
.tree-nav ul .tree-item a {
    padding-left: 0.5rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-light);
}
.tree-nav ul ul {
    margin-left: 0.75rem;
}
.tree-nav ul .active > .tree-item > a {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left-color: var(--sidebar-active-bar);
}
.tree-nav ul.collapsed { display: none; }

/* =============================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================= */
.content {
    flex: 1;
    padding: 2.5rem 3.5rem;
    max-width: 1400px; /* Расширяем для 3 колонок */
    min-width: 0;
    background: var(--white);
}

.page-content {
    font-size: 0.97rem;
    line-height: 1.78;
    color: #1f2937;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.page-content h2 { margin-top: 2rem; border-bottom: 1px solid var(--emerald-light); padding-bottom: 0.5rem; }
.page-content h3 { margin-top: 1.5rem; color: var(--emerald-deeper); }
.page-content > * + * { margin-top: 0.85rem; }

.page-content a {
    color: var(--emerald-dark);
    border-bottom: 1px solid var(--emerald-light);
}
.page-content a:hover { color: var(--emerald-deeper); border-bottom-color: var(--emerald); }

.page-content img {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    display: block;
}
.page-content blockquote {
    border-left: 3px solid var(--emerald);
    padding: 0.85rem 1.25rem;
    background: var(--emerald-soft);
    margin: 1.5rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: #374151;
    font-size: 0.95rem;
}
.page-content pre {
    background: #1e293b;
    color: #f8fafc;
    padding: 1rem 1.25rem 1.25rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.7;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-md);
    border: 1px solid #0f172a;
}
.page-content pre::before {
    content: '';
    display: block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 19px 0 0 #eab308, 38px 0 0 #22c55e;
    margin-bottom: 1.1rem;
    opacity: 0.9;
}
.page-content pre::-webkit-scrollbar {
    height: 8px;
}
.page-content pre::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.page-content pre::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}
.page-content pre::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}
.page-content code {
    word-break: break-word;
    background: var(--emerald-soft);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-xs);
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    font-size: 0.875em;
    color: var(--emerald-dark);
    border: 1px solid var(--emerald-light);
}
.page-content pre code { background: none; padding: 0; border: none; color: inherit; font-size: 0.9em; }

/* Адаптивная обертка для таблиц */
.table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    background: var(--white);
}
.table-responsive table {
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: none !important;
    display: table !important;
    min-width: 600px; /* Предотвращает сплющивание колонок на мобильных */
}

/* Таблицы */
.page-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    font-size: 0.9rem;
}
.page-content th {
    background: var(--emerald);
    color: #ffffff;
    font-weight: 600;
    padding: 0.8rem 1rem;
    text-align: left;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}
.page-content td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    color: #374151;
}
.page-content tr:last-child td { border-bottom: none; }
.page-content tr:nth-child(even) td { background: var(--emerald-soft); }
.page-content tr:hover td { background: #f0fdf4; transition: var(--transition); }

.page-content ul, .page-content ol { margin: 0.75rem 0 1rem; }
.page-content li { margin-bottom: 0.3rem; }

/* =============================================
   ХЛЕБНЫЕ КРОШКИ
   ============================================= */
.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    padding: 0.6rem 0.85rem;
    background: var(--gold-soft);
    border: 1px solid var(--gold-mid);
    border-radius: var(--radius-sm);
}
.breadcrumbs a {
    color: var(--gold-dark);
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
    font-weight: 500;
}
.breadcrumbs a:hover { color: #6b4c08; background: var(--gold-mid); }
.breadcrumbs .separator { color: var(--gold-dark); margin: 0 2px; opacity: 0.5; }
.breadcrumbs a:last-child { color: var(--emerald-deeper); font-weight: 700; pointer-events: none; }

/* =============================================
   ОБЕРТКА КОНТЕНТА И ОГЛАВЛЕНИЕ (TOC)
   ============================================= */
.page-body-wrap {
    display: flex;
    gap: 3.5rem; /* Увеличили отступ между статьей и оглавлением */
    align-items: flex-start;
}
.page-content-main {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 850px; /* Ограничитель текста для идеальной читаемости */
}
.page-toc {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    box-shadow: var(--shadow-xs);
}
.page-toc h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    letter-spacing: 0.05em;
}
.page-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.page-toc a {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
    padding: 0.35rem 0.5rem 0.35rem 0.85rem;
    border-left: 2px solid transparent;
    line-height: 1.4;
}
.page-toc a:hover {
    color: var(--emerald);
    border-left-color: var(--emerald-mid);
    background: var(--bg-soft);
    border-radius: 0 4px 4px 0;
}
.page-toc a.active {
    color: var(--emerald-dark);
    border-left-color: var(--emerald);
    font-weight: 600;
    background: var(--emerald-soft);
    border-radius: 0 4px 4px 0;
}

/* =============================================
   РЕЗУЛЬТАТЫ ПОИСКА
   ============================================= */
.search-results { list-style: none; padding: 0; margin: 1rem 0; }
.search-results li { margin-bottom: 0.5rem; }
.search-results a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.85rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 3px solid var(--emerald);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}
.search-results a:hover {
    border-left-color: var(--gold);
    background: var(--gold-soft);
    color: var(--gold-dark);
    transform: translateX(4px);
}

/* Пагинация (общая) */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin: 2rem 0; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 0.5rem; border: 1px solid var(--border-mid); border-radius: var(--radius-sm); color: var(--text-light); text-decoration: none; font-size: 0.9rem; font-weight: 500; background: var(--white); transition: var(--transition); }
.pagination a:hover { background: var(--bg-soft); border-color: var(--border-strong); color: var(--emerald-dark); }
.pagination .active { background: var(--emerald); color: #fff; border-color: var(--emerald-dark); font-weight: 700; box-shadow: 0 2px 6px rgba(11,94,66,0.2); }
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* Колонтитулы */
.content-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--emerald-light);
}
.content-footer {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Счетчик просмотров */
.page-view-counter {
    display: inline-block;
    padding: 0.15rem 0.35rem;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    opacity: 0.3;
    transition: var(--transition);
    cursor: default;
}
.page-view-counter:hover {
    opacity: 0.8;
    background: var(--bg-soft);
}

/* =============================================
   СТРАНИЦА ВХОДА
   ============================================= */
body.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 40%, #fefce8 100%);
}
.admin-login form {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
    text-align: center;
    border: 1px solid var(--emerald-light);
    border-top: 3px solid var(--emerald);
}
.login-icon {
    width: 52px;
    height: 52px;
    background: var(--emerald-soft);
    border: 1px solid var(--emerald-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--emerald-dark);
}
.login-icon svg { width: 26px; height: 26px; }
.admin-login h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--emerald-deeper);
    margin-bottom: 0.35rem;
}
.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}
.admin-login input[type="password"] {
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    width: 100%;
    border-color: var(--border-mid);
    border-radius: var(--radius-sm);
    color: var(--text);
}
.admin-login button {
    width: 100%;
    padding: 0.9rem;
    font-size: 0.975rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--emerald);
    border: 1px solid var(--emerald-dark);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 14px rgba(5,150,105,0.3);
    transition: var(--transition);
}
.admin-login button:hover {
    background: var(--emerald-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(5,150,105,0.35);
    color: #ffffff;
}
.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* =============================================
   ADMIN ПАНЕЛЬ
   ============================================= */
body.admin { background: var(--bg); }

body.admin header {
    background: var(--emerald-deeper);
    border-bottom: 1px solid var(--emerald-dark);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 12px rgba(6,95,70,0.2);
}
body.admin header h1 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    border: none;
    padding: 0;
    margin: 0 1.25rem 0 0;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.admin-nav-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
    margin: 0 0.25rem;
}
body.admin header a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.42rem 0.85rem;
    font-size: 0.855rem;
    font-weight: 600;
    color: rgba(255,255,255,0.72);
    border-radius: var(--radius-xs);
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
body.admin header a:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}
body.admin header .btn-add {
    margin-left: 0.5rem;
    min-height: 32px;
    padding: 0.38rem 0.9rem;
    font-size: 0.855rem;
    background: var(--gold);
    border-color: var(--gold-dark);
    box-shadow: 0 2px 8px rgba(183,134,11,0.3);
}
body.admin header .btn-add:hover {
    background: var(--gold-dark);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(183,134,11,0.35);
    transform: translateY(-1px);
}
body.admin header a[href*="logout"] {
    margin-left: auto;
    color: rgba(255,255,255,0.5);
}
body.admin header a[href*="logout"]:hover {
    background: rgba(185,28,28,0.2);
    color: #fca5a5;
}

/* Сообщения */
.message {
    margin: 1.25rem 1.5rem;
    padding: 0.85rem 1rem 0.85rem 1.1rem;
    background: var(--emerald-soft);
    border: 1px solid var(--emerald-light);
    border-left: 4px solid var(--emerald);
    border-radius: var(--radius-sm);
    color: var(--emerald-deeper);
    font-weight: 600;
    font-size: 0.9rem;
}
.message.error {
    background: #fef2f2;
    border-color: #fecaca;
    border-left-color: #b91c1c;
    color: #b91c1c;
}

/* Дерево в админке */
.tree-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin: 0 1.5rem 1.5rem;
    overflow: hidden;
}
.tree-container-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, var(--emerald-soft) 0%, var(--white) 100%);
    border-left: 3px solid var(--emerald);
}
.tree-container-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--emerald-deeper);
    margin: 0;
    flex: 1;
    border: none;
    padding: 0;
}

.tree { list-style: none; padding: 0.75rem 0; margin: 0; }
.tree, .tree ul { list-style: none; }
.tree ul {
    padding-left: 1rem;
    border-left: 2px solid var(--emerald-light);
    margin-left: 1rem;
}
.tree ul.collapsed { display: none; }
.tree li { margin: 2px 0; }
.tree .tree-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 1rem;
    transition: var(--transition);
    border-left: 2px solid transparent;
}
.tree .tree-item:hover {
    background: var(--emerald-soft);
    border-left-color: var(--emerald-mid);
}
.tree .tree-item strong {
    flex: 1;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

/* Actions в дереве */
.actions {
    display: flex;
    align-items: center;
    gap: 3px;
    opacity: 0;
    transition: var(--transition);
}
.tree-item:hover .actions { opacity: 1; }
.actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    transition: var(--transition);
    color: var(--text-muted);
    border: 1px solid transparent;
}
.actions a:hover {
    background: var(--bg-soft);
    border-color: var(--border);
    color: var(--text);
}
.actions a[title="Удалить"]:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* Форма редактирования */
.edit-form {
    max-width: 940px;
    margin: 1.5rem;
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.edit-form h2 {
    font-size: 1.15rem;
    color: var(--emerald-deeper);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--emerald-light);
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-group { margin-bottom: 1.25rem; }
.edit-form label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.72rem 1rem;
    background: var(--emerald-soft);
    border: 1px solid var(--emerald-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.checkbox-row:hover { background: var(--emerald-light); border-color: var(--emerald-mid); }
.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--emerald);
    cursor: pointer;
}
.checkbox-row span { font-size: 0.9rem; font-weight: 500; color: var(--emerald-deeper); cursor: pointer; }
.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* Редактор */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 0.6rem 0.75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border-mid);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-toolbar button {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    min-height: 30px;
    min-width: 30px;
    box-shadow: none;
    gap: 4px;
}
.editor-toolbar button:hover {
    background: var(--emerald);
    border-color: var(--emerald-dark);
    color: #ffffff;
    transform: none;
    box-shadow: none;
}
.toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 3px;
    flex-shrink: 0;
}
.editor-content {
    border: 1px solid var(--border-mid);
    border-top: none;
    padding: 1.25rem;
    min-height: 320px;
    background: var(--white);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 0.94rem;
    line-height: 1.7;
    color: var(--text);
    outline: none;
}
.editor-content:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(5,150,105,0.15);
}
.editor-content table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 1rem 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.editor-content td, .editor-content th {
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 0.85rem;
    text-align: left;
}
.editor-content tr:last-child td { border-bottom: none; }
.editor-content tr:nth-child(even) { background: var(--emerald-soft); }
.editor-content code { background: var(--emerald-soft); padding: 0.15rem 0.4rem; border-radius: var(--radius-xs); font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace; font-size: 0.875em; color: var(--emerald-dark); border: 1px solid var(--emerald-light); }
.editor-content pre { background: #1e293b; color: #f8fafc; padding: 1rem 1.25rem 1.25rem; border-radius: var(--radius-sm); font-size: 0.875rem; line-height: 1.7; overflow-x: auto; box-shadow: var(--shadow-md); border: 1px solid #0f172a; margin: 1.5rem 0; }
.editor-content pre::before { content: ''; display: block; width: 11px; height: 11px; border-radius: 50%; background: #ef4444; box-shadow: 19px 0 0 #eab308, 38px 0 0 #22c55e; margin-bottom: 1.1rem; opacity: 0.9; }
.editor-content pre code { background: none; padding: 0; border: none; color: inherit; font-size: 0.9em; }
.editor-content blockquote { border-left: 3px solid var(--emerald); padding: 0.85rem 1.25rem; background: var(--emerald-soft); margin: 1.5rem 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: #374151; font-size: 0.95rem; }

/* Поиск в админке */
.admin-search { margin: 0 1.5rem 1.25rem; }
.admin-search form {
    display: flex;
    gap: 0.5rem;
    max-width: 440px;
}
.admin-search input[type="text"] { width: auto; flex: 1; }

/* =============================================
   МОБИЛЬНЫЙ TOGGLE
   ============================================= */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 100;
    width: 48px;
    height: 48px;
    background: var(--emerald);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(5,150,105,0.35);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--transition);
}
.sidebar-toggle:hover {
    background: var(--emerald-dark);
    transform: scale(1.05);
    color: #ffffff;
}

/* =============================================
   АДАПТИВНОСТЬ
   ============================================= */
@media (max-width: 1024px) {
    :root { --sidebar-width: 280px; }
    .content { padding: 2rem 2.5rem; }
}
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        z-index: 90;
        transition: left 0.25s ease;
        width: 300px;
        box-shadow: none;
        height: 100vh;
    }
    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 89;
    }
    .sidebar-overlay.open { display: block; }
    .sidebar-toggle { display: flex; }
    .content { padding: 1.25rem 1rem; max-width: 100%; }
    body.admin header { padding: 0 1rem; flex-wrap: wrap; height: auto; min-height: 52px; padding-top: 0.5rem; padding-bottom: 0.5rem; }
    .admin-body { padding: 1rem; }
    .tree-container, .edit-form { margin: 0 0 1rem; }
    .admin-search { margin: 0 0 1rem; }
    .admin-search form { max-width: 100%; }
    .page-body-wrap { flex-direction: column; }
    .page-toc { width: 100%; position: static; margin-top: 1rem; }
    .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* =============================================
   СКРОЛЛБАР
   ============================================= */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--emerald-mid); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--emerald); }

/* =============================================
   ПЕЧАТЬ
   ============================================= */
@media print {
    .sidebar, .search-form, .pinned, .tree-nav,
    .toggle, .toggle-placeholder, .sidebar-toggle { display: none !important; }
    .layout { display: block !important; }
    .content { max-width: 100% !important; padding: 0 !important; }
    body { background: white !important; color: black !important; font-size: 12pt; }
    a { color: black !important; text-decoration: none !important; }
    img { max-width: 100% !important; page-break-inside: avoid; }
    table { border-collapse: collapse !important; }
    td, th { border: 1px solid #aaa !important; }
    h1, h2, h3, h4 { page-break-after: avoid; }
    p, blockquote, pre, ul, ol { page-break-inside: avoid; }
    * { box-shadow: none !important; }
}

/* =============================================================
   СТРАНИЦА ЛИЦЕНЗИРОВАНИЯ (license.php)
   ============================================================= */

body.license-page {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #fefce8 100%);
    min-height: 100vh;
}

.lic-wrap { max-width: 680px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }

.lic-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:2rem; flex-wrap:wrap; gap:1rem; }
.lic-logo img { max-height:52px; width:auto; display:block; filter:drop-shadow(0 1px 4px rgba(5,150,105,.15)); }
.lic-title-link { font-size:1.15rem; font-weight:800; color:var(--emerald-deeper); text-decoration:none; }
.lic-back { font-size:.875rem; font-weight:600; color:var(--text-light); text-decoration:none; padding:.4rem .75rem; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--white); transition:var(--transition); }
.lic-back:hover { background:var(--emerald-soft); color:var(--emerald-deeper); border-color:var(--emerald-mid); }

.lic-card { background:var(--card-white); border-radius:2rem; box-shadow:var(--shadow-lg); border:1px solid var(--border); overflow:hidden; }
.lic-card-header { display:flex; align-items:flex-start; gap:1.25rem; padding:1.75rem 2rem 1.5rem; background:linear-gradient(135deg,var(--emerald-soft) 0%,var(--white) 100%); border-bottom:1px solid var(--border); }
.lic-icon { width:54px; height:54px; flex-shrink:0; background:var(--white); border:1px solid var(--emerald-light); border-radius:1rem; display:flex; align-items:center; justify-content:center; color:var(--emerald); box-shadow:0 4px 12px rgba(11,94,66,.1); }
.lic-card-header h1 { font-size:1.35rem; font-weight:800; color:var(--emerald-deeper); margin:0 0 .4rem; padding:0; border:none; letter-spacing:-.025em; }
.lic-subtitle { font-size:.9rem; color:var(--text-light); margin:0; line-height:1.55; }

.lic-error { margin:1.25rem 2rem 0; padding:.85rem 1rem; background:#fef2f2; border:1px solid #fecaca; border-left:3px solid #b91c1c; border-radius:var(--radius-sm); color:#b91c1c; font-size:.9rem; font-weight:600; }

.lic-form { padding:1.75rem 2rem; }
.lic-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem 1.25rem; margin-bottom:1.5rem; }
@media (max-width:560px){ .lic-form-grid { grid-template-columns:1fr; } }
.lic-field label { display:block; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); margin-bottom:.4rem; }
.lic-field .req { color:#b91c1c; }
.lic-field input, .lic-field select { width:100%; padding:.7rem .9rem; border:1px solid var(--border-mid); border-radius:var(--radius-sm); font-size:.92rem; font-family:inherit; color:var(--text); background:var(--white); transition:var(--transition); outline:none; appearance: none; }
.lic-field input:focus, .lic-field select:focus { border-color:var(--emerald); box-shadow:0 0 0 3px rgba(5,150,105,.12); }

.lic-number-input { display:flex; align-items:stretch; border:1px solid var(--border-mid); border-radius:var(--radius-sm); background:var(--white); transition:var(--transition); overflow:hidden; }
.lic-number-input:focus-within { border-color:var(--emerald); box-shadow:0 0 0 3px rgba(5,150,105,.12); }
.lic-number-input input { border:none !important; border-radius:0 !important; box-shadow:none !important; text-align:center; -moz-appearance:textfield; width:100%; flex:1; }
.lic-number-input input::-webkit-outer-spin-button, .lic-number-input input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.lic-number-input .btn-num { width:46px; border:none; background:var(--bg-soft); color:var(--text-light); font-size:1.25rem; font-weight:600; cursor:pointer; transition:var(--transition); box-shadow:none; border-radius:0; padding:0; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin:0; }
.lic-number-input .btn-num:hover { background:var(--emerald-soft); color:var(--emerald-dark); }
.lic-number-input .btn-num:active { background:var(--emerald-light); }
.lic-number-input .btn-num-minus { border-right:1px solid var(--border-mid); }
.lic-number-input .btn-num-plus { border-left:1px solid var(--border-mid); }

.lic-price-box { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.25rem; background:var(--bg-soft); border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:1.25rem; transition:var(--transition); flex-wrap:wrap; }
.lic-price-box.free, .lic-price-box.paid { background:var(--emerald-soft); border-color:var(--emerald-mid); }
.lic-price-label { font-size:.8rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); }
.lic-price-amount { font-size:1.85rem; font-weight:800; color:var(--emerald-deeper); letter-spacing:-.03em; }
.lic-price-note { font-size:.8rem; color:var(--text-muted); width:100%; padding-top:.25rem; }

.lic-tiers { margin-bottom:1.25rem; }
.lic-tiers-title { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--gold); margin-bottom:.5rem; }
.lic-tiers-grid { display:flex; flex-wrap:wrap; gap:.5rem; }
.lic-tier-item { flex:1 1 auto; min-width:130px; padding:.6rem .85rem; background:var(--white); border:1px solid var(--border); border-left:2px solid var(--emerald); border-radius:var(--radius-sm); display:flex; flex-direction:column; gap:2px; }
.lic-tier-range { font-size:.8rem; color:var(--text-light); }
.lic-tier-price { font-size:1rem; font-weight:700; color:var(--emerald-deeper); }

.lic-warning-box { display:flex; align-items:flex-start; gap:.6rem; padding:.85rem 1rem; background:#fffbeb; border:1px solid #fde68a; border-left:3px solid var(--gold); border-radius:var(--radius-sm); font-size:.875rem; color:#78350f; line-height:1.55; margin-bottom:1.5rem; }
.lic-warning-box svg { color:var(--gold); margin-top:1px; }

.lic-submit { text-align:center; }
.lic-btn-submit { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:.9rem 2.25rem; font-size:1rem; font-weight:700; color:#fff; background:var(--emerald); border:1px solid var(--emerald-dark); border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); box-shadow:0 4px 16px rgba(5,150,105,.3); font-family:inherit; min-height:48px; }
.lic-btn-submit:hover { background:var(--emerald-dark); transform:translateY(-2px); box-shadow:0 8px 24px rgba(5,150,105,.35); color:#fff; }
.lic-submit-note { font-size:.8rem; color:var(--text-muted); margin-top:.6rem; }

/* Пользовательские кнопки услуг в сайдбаре */
.sidebar-custom-btn { display:flex; align-items:center; gap:6px; margin:0 0.75rem 0.35rem; padding:0.4rem 0.75rem; background:var(--bg-soft); color:var(--text-light); font-size:.78rem; font-weight:600; border-radius:4px; text-decoration:none; transition:var(--transition); border:1px solid var(--border); }
.sidebar-custom-btn:first-of-type { margin-top: 0.5rem; }
.sidebar-custom-btn:hover { background:var(--emerald-soft); color:var(--emerald-dark); border-color:var(--emerald-light); }
.sidebar-custom-btn svg { flex-shrink:0; color:var(--emerald-mid); width: 14px; height: 14px; }

/* Цветные модификаторы пользовательских кнопок */
.sidebar-custom-btn.color-primary { background:linear-gradient(135deg,var(--emerald) 0%,var(--emerald-mid) 100%); color:#fff !important; font-weight:700; border:none; box-shadow:0 4px 10px rgba(11,94,66,.15); }
.sidebar-custom-btn.color-primary:hover { background:linear-gradient(135deg,var(--emerald-mid) 0%,var(--emerald-dark) 100%); transform:translateY(-2px); box-shadow:0 12px 24px rgba(11,94,66,.3); border:none; color:#fff !important; }
.sidebar-custom-btn.color-primary svg { color:#fff; opacity:.9; }

.sidebar-custom-btn.color-green { background: var(--emerald-soft); color: var(--emerald-dark); border-color: var(--emerald-light); }
.sidebar-custom-btn.color-green:hover { background: var(--emerald); color: #fff; border-color: var(--emerald-dark); }
.sidebar-custom-btn.color-green svg { color: var(--emerald); }
.sidebar-custom-btn.color-green:hover svg { color: #fff; }

.sidebar-custom-btn.color-gold { background: var(--gold-soft); color: var(--gold-dark); border-color: var(--gold-light); }
.sidebar-custom-btn.color-gold:hover { background: var(--gold); color: #fff; border-color: var(--gold-dark); }
.sidebar-custom-btn.color-gold svg { color: var(--gold); }
.sidebar-custom-btn.color-gold:hover svg { color: #fff; }

.sidebar-custom-btn.color-blue { background: #eff6ff; color: #0f172a; border-color: #dbeafe; }
.sidebar-custom-btn.color-blue:hover { background: #3b82f6; color: #fff; border-color: #2563eb; }
.sidebar-custom-btn.color-blue svg { color: #3b82f6; }
.sidebar-custom-btn.color-blue:hover svg { color: #fff; }

.sidebar-custom-btn.color-red { background: #fef2f2; color: #991b1b; border-color: #fee2e2; }
.sidebar-custom-btn.color-red:hover { background: #ef4444; color: #fff; border-color: #dc2626; }
.sidebar-custom-btn.color-red svg { color: #ef4444; }
.sidebar-custom-btn.color-red:hover svg { color: #fff; }

.sidebar-custom-btn.color-purple { background: #f3e8ff; color: #581c87; border-color: #e9d5ff; }
.sidebar-custom-btn.color-purple:hover { background: #9333ea; color: #fff; border-color: #7e22ce; }
.sidebar-custom-btn.color-purple svg { color: #9333ea; }
.sidebar-custom-btn.color-purple:hover svg { color: #fff; }

.sidebar-custom-btn.color-orange { background: #ffedd5; color: #78350f; border-color: #fed7aa; }
.sidebar-custom-btn.color-orange:hover { background: #ea580c; color: #fff; border-color: #c2410c; }
.sidebar-custom-btn.color-orange svg { color: #ea580c; }
.sidebar-custom-btn.color-orange:hover svg { color: #fff; }

.sidebar-custom-btn.color-cyan { background: #cffafe; color: #083344; border-color: #a5f3fc; }
.sidebar-custom-btn.color-cyan:hover { background: #06b6d4; color: #fff; border-color: #0891b2; }
.sidebar-custom-btn.color-cyan svg { color: #06b6d4; }
.sidebar-custom-btn.color-cyan:hover svg { color: #fff; }

.sidebar-custom-btn.color-gray { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.sidebar-custom-btn.color-gray:hover { background: #475569; color: #fff; border-color: #334155; }
.sidebar-custom-btn.color-gray svg { color: #475569; }
.sidebar-custom-btn.color-gray:hover svg { color: #fff; }
/* =============================================
   КАТАЛОГ УСЛУГ (catalog.php)
   ============================================= */
.service-catalog {
    margin-top: 2rem;
}
.service-category {
    margin-top: 2.5rem;
}
.service-category-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--emerald-deeper);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--emerald-light);
}
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 1.25rem;
}
.service-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.service-card:hover {
    border-color: var(--emerald-mid);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.service-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.service-desc { font-size: 0.9rem; color: var(--text-light); margin-bottom: 1.5rem; flex: 1; }
.service-price { font-size: 1.15rem; font-weight: 800; color: var(--gold-dark); margin-top: auto; }

/* Стили для таблиц в админке */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.875rem; }
.admin-table th { text-align: left; background: var(--bg-soft); padding: 0.75rem; border-bottom: 2px solid var(--border); font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; }
.admin-table td { padding: 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:hover { background: #fafafa; }
.admin-table td.lic-actions { text-align: right; white-space: nowrap; }
.admin-table td.lic-actions a { 
    text-decoration: none; 
    font-size: 1.3rem; 
    transition: var(--transition); 
    opacity: 0.9; 
    cursor: pointer; 
    display: inline-block; 
    line-height: 1; 
    margin-left: 10px;
    vertical-align: middle;
}
.admin-table td.lic-actions a:hover { transform: scale(1.3); opacity: 1; }

.admin-lic-container .admin-table th:nth-child(4), 
.admin-lic-container .admin-table td:nth-child(4) { text-align: center; }
.admin-lic-container .admin-table th:nth-child(5), 
.admin-lic-container .admin-table td:nth-child(5) { text-align: right; }

/* Календарь медиаплана */
.admin-calendars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.cal-month { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; box-shadow: var(--shadow-sm); }
.cal-title { font-weight: 700; text-align: center; margin-bottom: 0.75rem; color: var(--text); font-size: 0.95rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-dow { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; padding-bottom: 4px; }
.cal-day { min-height: 44px; border-radius: 4px; background: var(--bg-soft); display: flex; flex-direction: column; align-items: center; padding: 2px; position: relative; border: 1px solid transparent; }
.cal-day.empty { background: transparent; border: none; }
.cal-day.today { border-color: var(--emerald-mid); font-weight: 700; box-shadow: 0 0 0 1px var(--emerald-mid); }
.cal-day.has-pub { background: #dcfce7; border-color: #bbf7d0; }
.cal-day.has-sched { background: #e2e8f0; border-color: #cbd5e1; }
.cal-day.has-pub.has-sched { background: linear-gradient(135deg, #dcfce7 50%, #e2e8f0 50%); }
.d-num { font-size: 0.8rem; color: var(--text); z-index: 2; margin-bottom: 2px; }
.d-badges { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.c-badge { font-size: 0.65rem; color: #fff; padding: 0px 4px; border-radius: 8px; line-height: 1.2; font-weight: 700; }
.c-badge.pub { background: var(--emerald); }
.c-badge.sched { background: #64748b; }

/* =============================================
   БЛОГ КОМПАНИИ (blog.php)
   ============================================= */
.blog-post-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); transition: var(--transition); }
.blog-post-card:hover { border-color: var(--emerald-mid); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.blog-post-card h2 { margin: 0 0 0.5rem 0; font-size: 1.35rem; border: none; padding: 0; }
.blog-post-card h2 a { color: var(--emerald-deeper); text-decoration: none; border: none; }
.blog-post-card h2 a:hover { color: var(--emerald); }
.blog-meta { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
.blog-excerpt { font-size: 0.95rem; color: var(--text-light); line-height: 1.6; margin-bottom: 1.25rem; }
.blog-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.blog-nav .btn { min-width: 140px; }

.blog-sidebar-list { display: flex; flex-direction: column; gap: 0.25rem; margin: 0 -0.5rem; }
.page-toc a.blog-sidebar-item { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0.65rem 0.85rem; border-radius: var(--radius-sm); text-decoration: none; transition: var(--transition); border-left: 2px solid transparent; border-bottom: none; margin: 0; }
.page-toc a.blog-sidebar-item:hover { background: var(--bg-soft); border-left-color: var(--emerald-mid); border-radius: var(--radius-sm); }
.page-toc a.blog-sidebar-item.active { background: var(--emerald-soft); border-left-color: var(--emerald); box-shadow: 0 2px 8px rgba(11,94,66,0.08); border-radius: var(--radius-sm); }
.page-toc .blog-sidebar-title { font-size: 0.875rem; font-weight: 500; color: var(--text); line-height: 1.4; flex: 1; }
.page-toc a.blog-sidebar-item.active .blog-sidebar-title { color: var(--emerald-deeper); font-weight: 700; }
.page-toc .blog-sidebar-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; margin-bottom: 0; display: inline-block; }
.page-toc a.blog-sidebar-item.active .blog-sidebar-meta { color: var(--emerald); font-weight: 600; }

.blog-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; }
.blog-cat-link {
    display: inline-flex; align-items: center; padding: 6px 16px; border-radius: 40px; background: var(--white); color: var(--text-light); font-size: 0.85rem; font-weight: 600; text-decoration: none; transition: all 0.2s ease; border: 1px solid var(--border-strong); box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.blog-cat-link:hover { border-color: var(--emerald-mid); color: var(--emerald-dark); box-shadow: 0 4px 8px rgba(11,94,66,0.1); transform: translateY(-1px); }
.blog-cat-link.active { background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-mid) 100%); color: #fff; border-color: var(--emerald-dark); box-shadow: 0 4px 10px rgba(11,94,66,0.25); }

.blog-cat-badge {
    display: inline-flex; align-items: center; justify-content: center; padding: 4px 12px; border-radius: 20px; background: linear-gradient(135deg, var(--emerald-light) 0%, #e0f2fe 100%); color: var(--emerald-deeper); font-size: 0.75rem; font-weight: 800; margin-right: 10px; text-transform: uppercase; letter-spacing: 0.05em; border: 1px solid var(--emerald-light); box-shadow: 0 2px 4px rgba(11,94,66,0.05); text-decoration: none; transition: all 0.2s ease;
}
.blog-cat-badge:hover {
    background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-mid) 100%); color: #ffffff; border-color: var(--emerald-dark); box-shadow: 0 4px 8px rgba(11,94,66,0.2); transform: translateY(-1px);
}
