/* Tilda Comments — админка в стиле личного кабинета Tilda:
   серый фон, плоские карточки, моноширинные заголовки, пастельные статусы. */
:root {
    --bg: #f4f4f4;
    --card: #ffffff;
    --card-2: #f2f2f2;
    --line: #e6e6e6;
    --text: #1d1d1d;
    --text-2: #5e5e5e;
    --text-3: #8a8a8a;
    --dark: #1d1d1d;
    --green-bg: #ececec; --green-tx: #1d1d1d;
    --red-bg: #e4e4e4;   --red-tx: #1d1d1d;
    --amber-bg: #1d1d1d; --amber-tx: #ffffff;
    --radius: 16px;
    --radius-s: 10px;
    --font-main: 'Inter', -apple-system, 'Segoe UI', Arial, sans-serif;
    --panel-x: 28px;
    --panel-y: 28px;
    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 20px;
    --space-5: 24px;
    --space-6: 32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-main);
    font-size: 14.5px;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    /* фон — равномерная точечная сетка, нейтральный серый */
    background-color: #f4f4f4;
    background-image: radial-gradient(rgba(0, 0, 0, .06) 1px, transparent 1px);
    background-size: 22px 22px;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2 { font-family: var(--font-main); font-weight: 700; letter-spacing: -.4px; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }

.muted { color: var(--text-3); font-size: 13px; }

/* ---------- Topbar ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner {
    max-width: 1100px; margin: 0 auto; padding: 0 24px;
    height: 60px; display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 26px; width: auto; display: block; flex-shrink: 0; }
.brand-tag {
    font-size: 11px; color: var(--text-3); font-weight: 500;
    padding-left: 11px; border-left: 1px solid var(--line); line-height: 1.25;
    white-space: nowrap;
}

.topbar-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: var(--radius-s);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}
.topbar-burger:hover { background: rgba(0,0,0,.06); }
.topbar-burger-line {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: var(--text);
    transition: transform .2s ease, opacity .2s ease, width .2s ease;
}
.topbar-burger[aria-expanded="true"] .topbar-burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.topbar-burger[aria-expanded="true"] .topbar-burger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.topbar-burger[aria-expanded="true"] .topbar-burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.topnav-backdrop { display: none; }

.topnav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.topnav a {
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius-s);
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.topnav a:hover { background: var(--card-2); color: var(--text); text-decoration: none; }
.topnav .nav-super { font-weight: 700; }
.topnav .nav-muted { color: var(--text-2); }

/* ---------- Support notice (все страницы админки) ---------- */
.admin-support-notice {
    max-width: 1100px;
    margin: 28px auto 0;
    padding: 0 24px;
}
.admin-support-notice__inner {
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .03);
}
.admin-support-notice__title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-2);
    margin-bottom: 6px;
}
.admin-support-notice__text {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-2);
}
.admin-support-notice__text a {
    font-weight: 600;
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.admin-support-notice__text a:hover {
    color: #000;
}
.auth-layout .admin-support-notice {
    max-width: 440px;
    margin-top: 20px;
    padding: 0 16px 24px;
}
.admin-support-notice + .admin-support-notice {
    margin-top: 12px;
}
.admin-author-notice .admin-support-notice__inner {
    background: var(--card-2);
}
.admin-author-notice__inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.admin-author-notice__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--line);
    background: var(--card);
}
.admin-author-notice__body {
    flex: 1;
    min-width: 0;
}
.admin-author-notice__body .admin-support-notice__title {
    margin-bottom: 4px;
}

/* ---------- Layout ---------- */
.main { max-width: 1100px; margin: 0 auto; padding: 30px 24px 70px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head-title { display: inline-flex; align-items: center; gap: 10px; }
.page-head-title .adm-ico { color: var(--text-2); }
.breadcrumbs { font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.breadcrumbs a { color: var(--text-3); }
.h-domain { font-family: var(--font-main); font-size: 14px; font-weight: 400; margin-left: 8px; letter-spacing: 0; }

/* ---------- Карточки ---------- */
.card { background: var(--card); border: none; border-radius: var(--radius); }

/* ---------- Flash ---------- */
.flash { padding: 14px 20px; border-radius: 14px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: #ececec; color: #1d1d1d; border-left: 3px solid #1d1d1d; }
.flash-error { background: #1d1d1d; color: #ffffff; }
.flash-warning { background: #ececec; color: #1d1d1d; border-left: 3px solid #1d1d1d; }
.flash .btn-link { color: inherit; text-decoration: underline; }

/* ---------- Поля ---------- */
.field { position: relative; display: block; margin-bottom: 26px; }
.field-narrow { max-width: 420px; }
.field input, .field textarea, select {
    width: 100%; font: inherit; color: var(--text);
    padding: 13px 16px; background: var(--card-2);
    border: 1px solid transparent; border-radius: var(--radius-s);
    outline: none; transition: border-color .15s, background .15s;
}
.field input:focus, .field textarea:focus, select:focus { border-color: var(--dark); background: #f3f3f3; }
.field span {
    position: absolute; left: 16px; top: 14px;
    color: var(--text-3); font-size: 14px;
    pointer-events: none; transition: all .15s ease;
}
.field input:focus + span, .field input:not(:placeholder-shown) + span {
    top: -8px; left: 11px; font-size: 11px; color: var(--text-2); font-weight: 600;
    text-transform: uppercase; letter-spacing: .4px;
    background: var(--card); padding: 0 5px;
}

select { width: auto; cursor: pointer; }

.check { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--dark); cursor: pointer; }

.form-row { display: flex; gap: 16px; }
.form-row .field { flex: 1; }
@media (max-width: 640px) { .form-row { flex-direction: column; gap: 0; } }
.form-actions { display: flex; gap: 10px; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-block;
    font: inherit; font-size: 14px; font-weight: 600;
    color: #fff; background: var(--dark); border: none; border-radius: var(--radius-s);
    padding: 11px 26px; cursor: pointer;
    transition: background .15s, transform .1s;
    text-decoration: none;
}
.btn:hover { background: #000; color: #fff; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { background: #a9a9a9; color: #fff; cursor: default; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-outline { color: var(--text); background: rgba(0,0,0,.07); }
.btn-outline:hover { background: rgba(0,0,0,.13); color: var(--text); }
.btn-ok { color: #fff; background: #1d1d1d; }
.btn-ok:hover { background: #000; color: #fff; }
.btn-danger-outline { color: var(--text); background: #fff; box-shadow: inset 0 0 0 1px #d4d4d4; }
.btn-danger-outline:hover { background: #f2f2f2; color: var(--text); box-shadow: inset 0 0 0 1px #1d1d1d; }
.btn-link { border: none; background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }

/* Ссылки-кнопки: nav/tab не перебивают цвет текста */
a.btn:not(.btn-outline):not(.btn-danger-outline):not(.btn-link),
button.btn:not(.btn-outline):not(.btn-danger-outline) {
    color: #fff;
}
a.btn:not(.btn-outline):not(.btn-danger-outline):not(.btn-link):hover,
a.btn:not(.btn-outline):not(.btn-danger-outline):not(.btn-link):focus-visible,
button.btn:not(.btn-outline):not(.btn-danger-outline):hover,
button.btn:not(.btn-outline):not(.btn-danger-outline):focus-visible {
    color: #fff;
}
.topnav a.btn:not(.btn-outline) {
    color: #fff;
    background: var(--dark);
}
.topnav a.btn:not(.btn-outline):hover {
    background: #000;
    color: #fff;
}
.topnav a.btn-outline {
    color: var(--text);
    background: rgba(0,0,0,.07);
}
.topnav a.btn-outline:hover {
    background: rgba(0,0,0,.13);
    color: var(--text);
}

/* ---------- Авторизация ---------- */
.auth-layout { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-main { width: 100%; max-width: 460px; padding: 40px 16px 32px; margin: 0 auto; }
.auth-card { padding: 40px 36px 32px; }
.auth-logo {
    display: block;
    text-align: center;
    margin-bottom: 18px;
    text-decoration: none;
    color: inherit;
}
.auth-logo:hover { opacity: .82; }
.auth-logo .adm-ico { display: inline-flex; color: var(--text-2); }
.auth-logo img { height: 30px; width: auto; display: inline-block; vertical-align: middle; }
.auth-card h1 { text-align: center; margin-bottom: 8px; }
.auth-sub { text-align: center; color: var(--text-2); font-size: 13.5px; margin-bottom: 28px; }
.auth-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 20px;
    font-size: 13.5px;
}
.auth-links--split { justify-content: space-between; width: 100%; gap: 12px; }
.auth-links--center { justify-content: center; }
.auth-links a { color: var(--text-2); text-decoration: underline; }
.auth-links a:hover { color: var(--text); }
.auth-terms-link {
    margin: 14px 0 0;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.4;
}
.auth-terms-link a { color: var(--text-2); text-decoration: underline; }
.auth-terms-link a:hover { color: var(--text); }
.auth-terms {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 8px 0 18px;
    padding: 12px 14px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-2);
    cursor: pointer;
}
.auth-terms input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: var(--dark);
    cursor: pointer;
}
.auth-terms a { color: var(--text); text-decoration: underline; }
.auth-terms a:hover { color: var(--text); }
.auth-card__legal {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.auth-card__legal .site-disclaimer {
    font-size: 10.5px;
    line-height: 1.5;
    text-align: center;
    color: var(--text-3);
    margin: 0;
}

/* ---------- Дашборд ---------- */
.create-card { margin-bottom: 24px; }
.create-summary {
    list-style: none; cursor: pointer; padding: 18px 26px;
    font-family: var(--font-main); font-weight: 700; font-size: 15px; user-select: none;
    display: flex; align-items: center; gap: 10px;
}
.create-summary::-webkit-details-marker { display: none; }
.create-summary .adm-ico { color: var(--text-2); }
.create-form { padding: 12px 26px 24px; }

.projects-grid { display: flex; flex-direction: column; gap: 12px; }
.project-card { display: block; padding: 20px 26px; transition: background .15s; color: var(--text); }
.project-card:hover { background: #eaebea; text-decoration: none; }
.project-card-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.project-card-body { min-width: 0; flex: 1; }
.project-card h2 { font-size: 16px; margin-bottom: 4px; }
.project-card-aside {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty-icon { display: flex; justify-content: center; margin-bottom: 14px; color: var(--text-3); }

.adm-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ico-size, 18px);
    height: var(--ico-size, 18px);
    flex-shrink: 0;
    color: inherit;
    vertical-align: middle;
}
.adm-ico svg { display: block; width: 100%; height: 100%; }

.h-domain {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.h-domain .adm-ico { color: var(--text-3); }

.project-domain {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
    font-size: 13.5px;
}
.project-domain .adm-ico { color: var(--text-3); }

.project-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-2);
}
.project-stat .adm-ico { color: var(--text-3); }

.page-item-meta-line {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.page-item-meta-line .adm-ico { color: var(--text-3); }

/* ---------- Статистика ---------- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.stat-card { padding: var(--space-4) var(--space-5); text-align: center; }
.stat-num { font-family: var(--font-main); font-size: 26px; font-weight: 700; color: var(--text); }
.stat-warn { color: var(--text); }
.stat-ok { color: var(--text); }
.stat-muted { color: var(--text-3); }
.stat-label { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

/* ---------- Табы ---------- */
.tabs {
    display: flex; gap: 4px; margin-bottom: var(--space-5);
    overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
    padding: 10px 18px; border-radius: var(--radius-s);
    font-size: 14px; font-weight: 600; color: var(--text-2);
    transition: background .15s, color .15s;
}
.tab:hover { background: rgba(0,0,0,.05); color: var(--text); text-decoration: none; }
.tab-active { background: var(--dark); color: #fff; }
.tab-active:hover { background: #000; color: #fff; }
.tab .adm-ico { color: var(--text-3); }
.tab-active .adm-ico { color: rgba(255, 255, 255, .82); }
.tab-dot {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--amber-bg); color: var(--amber-tx);
    font-family: var(--font-main); font-size: 11px; font-weight: 700;
}
.tab-active .tab-dot { background: rgba(255,255,255,.22); color: #fff; }

/* ---------- Страницы (перепривязка) ---------- */
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .92em; }
.pages-list { display: flex; flex-direction: column; }
.page-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 2px; border-bottom: 1px solid var(--line);
}
.page-item:last-child { border-bottom: none; }
.page-item-info { min-width: 0; }
.page-item-id { font-size: 15px; font-weight: 600; margin-bottom: 3px; word-break: break-all; }
.page-item-meta { font-size: 12.5px; }
.page-rebind { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.page-rebind input {
    width: 180px; font: inherit; font-size: 13.5px; color: var(--text);
    padding: 8px 12px; background: var(--card-2); border: 1px solid transparent; border-radius: var(--radius-s);
    outline: none; transition: border-color .15s;
}
.page-rebind input:focus { border-color: var(--dark); background: #f6f6f6; }
@media (max-width: 640px) {
    .page-item { flex-direction: column; align-items: stretch; gap: 12px; }
    .page-rebind { width: 100%; }
    .page-rebind input { flex: 1; width: auto; }
}

/* ---------- Секции / вкладки проекта ---------- */
.section-card { margin-bottom: var(--space-5); }
.section-card > summary {
    list-style: none; cursor: pointer; padding: 18px var(--panel-x);
    font-family: var(--font-main); font-weight: 700; font-size: 15px; user-select: none;
}
.section-card > summary::-webkit-details-marker { display: none; }
.section-body { padding: var(--panel-y) var(--panel-x); }
details.section-card > .section-body { padding-top: var(--space-1); }
.hint { color: var(--text-2); font-size: 13.5px; line-height: 1.65; margin: 0 0 var(--space-3); }
.divider { border: none; border-top: 1px solid var(--line); margin: var(--space-5) 0; }

/* Единая оболочка вкладок проекта */
.tab-panel { margin-bottom: var(--space-5); }
.tab-panel__inner { padding: var(--panel-y) var(--panel-x) calc(var(--panel-y) + 4px); }
.tab-panel__head { margin-bottom: var(--space-5); }
.tab-panel__title,
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 var(--space-2);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.4px;
}
.tab-panel__title .adm-ico,
.section-title .adm-ico { color: var(--text-2); }
.tab-panel__lead {
    margin: 0;
    max-width: 52rem;
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.65;
}
.tab-panel__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--card-2);
    border-radius: var(--radius-s);
}
.tab-panel__toolbar .page-filter,
.tab-panel__toolbar .page-filter select { margin: 0; }
.tab-panel__section {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--line);
}
.tab-panel__subhead {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 var(--space-1);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.tab-panel__subhead .adm-ico { color: var(--text-2); }
.tab-panel__subhint {
    margin: 0 0 var(--space-4);
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.6;
}
.tab-panel__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
}
.tab-panel__note {
    margin: var(--space-4) 0 0;
    padding: var(--space-3) var(--space-4);
    background: var(--card-2);
    border-radius: var(--radius-s);
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.55;
}
.tab-panel__note .mono { color: var(--text); font-weight: 600; }
.tab-panel__danger {
    margin-top: var(--space-6);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: #fafafa;
}
.tab-panel__danger .tab-panel__subhead { margin-bottom: var(--space-2); }
.tab-panel__danger .tab-panel__subhint { margin-bottom: var(--space-4); }
.tab-panel .field { margin-bottom: var(--space-4); }
.tab-panel .form-row .field { margin-bottom: var(--space-4); }
.tab-panel .check { margin: 0 0 var(--space-3); }
.tab-panel .form-actions { margin-top: var(--space-1); }

/* ---------- Код встраивания ---------- */
.code-block {
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    overflow: hidden;
    background: var(--card-2);
}
.code-block__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.code-block__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .45px;
    color: var(--text-3);
}
.code-block pre {
    margin: 0;
    padding: var(--space-4);
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
    background: transparent;
}
.code-wrap { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.code-wrap pre {
    flex: 1; min-width: 260px;
    font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
    background: var(--card-2); border-radius: var(--radius-s);
    padding: 15px 18px; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.hint-key { margin: 16px 0 0; }

/* ---------- Фильтры ---------- */
.filters { display: flex; justify-content: space-between; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.filters:not(.tab-panel__toolbar) { margin-bottom: var(--space-4); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    padding: 8px 16px; border-radius: var(--radius-s); font-size: 13.5px; font-weight: 500;
    color: var(--text-2); background: rgba(0,0,0,.05);
    transition: background .15s, color .15s;
}
.chip:hover { background: rgba(0,0,0,.1); color: var(--text); text-decoration: none; }
.chip-active { color: #fff; background: var(--dark); }
.chip-active:hover { color: #fff; background: #000; }
.tab-panel__toolbar .chip { background: #fff; }
.tab-panel__toolbar .chip:hover { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.tab-panel__toolbar .chip-active,
.tab-panel__toolbar .chip-active:hover { background: var(--dark); color: #fff; box-shadow: none; }

/* ---------- Бейджи ---------- */
.badge {
    display: inline-block; padding: 3px 11px; border-radius: 8px;
    font-size: 11.5px; font-weight: 600; vertical-align: 1px;
}
.badge-ok { background: var(--green-bg); color: var(--green-tx); }
.badge-warning { background: var(--amber-bg); color: var(--amber-tx); }
.badge-danger { background: var(--red-bg); color: var(--red-tx); }
.badge-muted { background: rgba(0,0,0,.07); color: var(--text-2); }
.badge-page { background: rgba(0,0,0,.07); color: var(--text-2); font-family: var(--font-main); }
.badge-reply { background: rgba(0,0,0,.07); color: var(--text-2); }
.badge-admin { background: var(--dark); color: #fff; }
.badge-super { background: var(--dark); color: #fff; }

/* ---------- Список комментариев (модерация) ---------- */
.comment-list { display: flex; flex-direction: column; gap: var(--space-3); }
.comment-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
    transition: opacity .15s, box-shadow .15s, border-color .15s, background .15s;
}
.status-pending.comment-card { box-shadow: inset 3px 0 0 var(--dark); }
.status-deleted.comment-card { opacity: .55; }
.comment-card--selected { border-color: var(--dark); box-shadow: inset 0 0 0 1px var(--dark); background: #fafafa; }
.status-pending.comment-card--selected { box-shadow: inset 0 0 0 1px var(--dark); }

/* ----- шапка: чекбокс | аватар + автор | статусы ----- */
.comment-card-head { display: flex; align-items: flex-start; gap: 13px; }

.cmt-check { display: flex; align-items: center; padding-top: 11px; cursor: pointer; }
.cmt-check-box, .bulk-check-all input, #bulk-select-all {
    width: 18px; height: 18px; margin: 0; accent-color: var(--dark); cursor: pointer; flex-shrink: 0;
}

.comment-author { display: flex; align-items: center; gap: 12px; min-width: 0; }
.comment-avatar {
    width: 40px; height: 40px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--dark); color: #fff;
    font-size: 15px; font-weight: 600;
}
.comment-author-info { min-width: 0; }
.comment-author-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.comment-author-meta {
    display: flex; flex-wrap: wrap; gap: 2px 8px;
    font-size: 12.5px; color: var(--text-3); margin-top: 3px;
}
.comment-author-meta span:not(:last-child)::after { content: '·'; margin-left: 8px; color: var(--text-3); }

.comment-statuses { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-left: auto; padding-top: 2px; }
.badge-reply { display: inline-flex; align-items: center; gap: 4px; }
.badge-admin { display: inline-flex; align-items: center; gap: 4px; background: var(--dark); color: #fff; }

.comment-reply-form {
    margin: 14px 0 0 53px;
    padding: 14px 16px;
    background: var(--card-2);
    border-radius: var(--radius-s);
    border: 1px solid var(--line);
}
.comment-reply-form__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 8px;
}
.comment-reply-form textarea {
    width: 100%;
    min-height: 72px;
    font: inherit;
    font-size: 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    resize: vertical;
    margin-bottom: 10px;
    background: var(--card);
    color: var(--text);
}
.comment-reply-form textarea:focus {
    outline: none;
    border-color: var(--dark);
}
.comment-reply-form .btn { display: inline-flex; align-items: center; gap: 6px; }

/* ----- тело и подвал выровнены под именем автора (отступ = аватар + gap) ----- */
.comment-body {
    font-size: 14.5px; line-height: 1.6; word-wrap: break-word; color: var(--text);
    margin: 12px 0 0 53px;
}

.comment-card-foot {
    display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
    margin: 16px 0 0 53px;
}
.comment-context { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; min-width: 0; }
.comment-page-link, .comment-page-id {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; color: var(--text-2); text-decoration: none; max-width: 100%;
}
.comment-page-link:hover { color: var(--text); text-decoration: underline; }
.comment-page-link .adm-ico, .comment-page-id .adm-ico { color: var(--text-3); flex-shrink: 0; }
.comment-ip { font-size: 11.5px; color: var(--text-3); }
.comment-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: auto; }

@media (max-width: 640px) {
    .comment-body, .comment-card-foot { margin-left: 0; }
    .comment-reply-form { margin-left: 0; }
    .comment-card-foot { align-items: stretch; }
    .comment-actions { margin-left: 0; justify-content: flex-end; width: 100%; }
}

/* ----- тулбар массовых действий ----- */
.bulk-bar {
    display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
    padding: var(--space-2) var(--space-4); margin-bottom: var(--space-4);
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s);
    position: sticky; top: 12px; z-index: 20;
}
.bulk-bar--active { background: #fafafa; border-color: var(--dark); }
.bulk-check-all { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; font-size: 13.5px; user-select: none; }
.bulk-count { font-size: 13.5px; color: var(--text-2); }
.bulk-count b { color: var(--text); }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.page-item-title { margin-bottom: 4px; }
.page-item-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.page-item-link:hover { text-decoration: underline; }
.page-item-link .adm-ico { color: var(--text-3); }

@media (max-width: 640px) {
    .comment-card-head { flex-direction: column; gap: 10px; }
    .comment-statuses { justify-content: flex-start; }
    .comment-card-foot { flex-direction: column; align-items: stretch; }
    .comment-actions { justify-content: flex-end; margin-left: 0; }
}

.page-filter select { max-width: 320px; }

/* ---------- Пагинация ---------- */
.pagination-wrap { margin-top: var(--space-5); }
.pagination-meta { text-align: center; font-size: 13px; margin-bottom: 10px; }
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.page-num {
    min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-s); font-family: var(--font-main); font-size: 13.5px; color: var(--text-2);
}
.page-num:hover { background: rgba(0,0,0,.07); text-decoration: none; }
.page-ellipsis { cursor: default; color: var(--text-3); }
.page-ellipsis:hover { background: transparent; }
.page-current { background: var(--dark); color: #fff; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; color: var(--text-3); font-weight: 600; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .5px;
    padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(0,0,0,.025); }
.table a { text-decoration: underline; }
.row-blocked td { opacity: .55; }
.check-inline { margin: 0; justify-content: center; }
.field-settings-table .check-inline input { margin-top: 0; }
.field-settings-table th:nth-child(2),
.field-settings-table th:nth-child(3),
.field-settings-table td:nth-child(2),
.field-settings-table td:nth-child(3) { text-align: center; width: 120px; }
.section-subtitle { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 var(--space-1); }

/* ---------- Дизайн виджета ---------- */
.design-layout {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
}

.design-layout-main { min-width: 0; }

.design-section {
    margin: 0 0 var(--space-5);
    padding: 0 0 var(--space-5);
    border-bottom: 1px solid var(--line);
}
.design-section-last,
.design-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.design-section-title,
.design-preview-title,
.tab-panel__subhead {
    margin: 0 0 var(--space-1);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.design-section-hint,
.design-layout-aside .design-section-hint {
    margin: 0 0 var(--space-3);
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-2);
}

.design-form { max-width: none; }
.design-segments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.design-segments-theme {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.design-segments-corners {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.design-segment {
    position: relative;
    cursor: pointer;
    min-width: 0;
}
.design-segment input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.design-segment span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--radius-s);
    background: rgba(0, 0, 0, .06);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    transition: background .15s, color .15s;
}
.design-segment:hover span { background: rgba(0, 0, 0, .1); }
.design-segment input:checked + span {
    background: var(--dark);
    color: #fff;
}
.design-segment input:focus-visible + span {
    outline: 2px solid var(--dark);
    outline-offset: 2px;
}
.design-color-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.design-color-picker {
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}
.design-color-field { flex: 1 1 140px; min-width: 0; margin: 0; }

.design-reset-form { display: none; }

.design-preview {
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    overflow: hidden;
    padding: var(--space-3);
    background: #f1f1f0;
}
.design-preview--light { background: #f5f5f4; }
.design-preview--dark { background: #141414; }
.design-preview iframe {
    width: 100%;
    min-height: 480px;
    border: 0;
    display: block;
    background: transparent;
}

@media (max-width: 960px) {
    .design-layout {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }
    .design-layout-aside {
        padding-top: var(--space-5);
        border-top: 1px solid var(--line);
    }
}

@media (min-width: 520px) {
    .design-segments-theme {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ====================== Мобильная вёрстка ====================== */
@media (max-width: 760px) {
    .topbar-inner { padding: 0 16px; height: 56px; }
    .brand-logo { height: 22px; }
    .brand-tag {
        display: block;
        white-space: normal;
        font-size: 10px;
        line-height: 1.2;
        padding-left: 9px;
    }

    .topbar-burger { display: inline-flex; }

    .topnav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .32);
        z-index: 55;
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease, visibility .2s ease;
    }
    .topnav-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .topnav {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 60;
        width: min(300px, calc(100vw - 48px));
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 72px 16px 24px;
        background: var(--card);
        border-left: 1px solid var(--line);
        box-shadow: -8px 0 32px rgba(0, 0, 0, .08);
        transform: translateX(100%);
        transition: transform .24s ease;
        overflow-y: auto;
    }
    .topnav.is-open { transform: translateX(0); }
    .topnav a {
        font-size: 15px;
        padding: 12px 14px;
        white-space: normal;
    }

    body.topnav-open { overflow: hidden; }

    .main { padding: 22px 16px 56px; }
    h1 { font-size: 19px; }
    .page-head { margin-bottom: 18px; gap: 10px; }
    .h-domain { display: block; margin: 6px 0 0; }

    .card { border-radius: 16px; }
    .section-card > summary,
    .create-summary { padding: 16px 18px; }
    .section-body,
    .tab-panel__inner,
    .create-form { padding: 20px 18px 22px; }
    .stat-card { padding: 16px 14px; }
    .stat-num { font-size: 22px; }
    .project-card { padding: 18px 18px; }
    .project-card-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .project-card-aside { width: 100%; justify-content: flex-start; }

    .auth-main { padding: 24px 14px; }
    .auth-card { padding: 32px 22px 26px; }

    .filters { gap: 10px; }
    .page-filter, .page-filter select { width: 100%; max-width: none; }

    .code-wrap pre { min-width: 0; width: 100%; }
}

@media (max-width: 380px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
}

.pages-table__page { min-width: 160px; }
.pages-table__link { font-weight: 600; }
.pages-table__id { font-size: 12px; margin-top: 4px; word-break: break-all; }
.pages-table__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}
.pages-table__form { display: inline; margin: 0; }
.pages-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.pages-badge .adm-ico { --ico-size: 13px; opacity: .85; }

.widget-install-guide { margin-top: var(--space-5); }
.widget-install-steps {
    margin: var(--space-2) 0 var(--space-3);
    padding-left: 1.25rem;
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.65;
}
.widget-install-steps li { margin-bottom: 6px; }

@media (max-width: 900px) {
    .pages-table__actions {
        flex-direction: column;
        align-items: stretch;
    }
    .pages-table__actions .btn { width: 100%; }
}
