/* HOZMAG — админка */
:root {
    --yellow: #f5b301;
    --yellow-dark: #e0a200;
    --yellow-soft: #fff7e0;
    --ink: #1f2328;
    --muted: #74797f;
    --line: #e6e8eb;
    --bg: #f4f5f7;
    --white: #fff;
    --green: #2f7d32;
    --red: #c0392b;
    --radius: 12px;
    --shadow: 0 10px 24px rgba(20, 24, 28, .05);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
code { font-size: 12px; background: #f2f3f5; padding: 2px 5px; border-radius: 4px; }

.icon { width: 20px; height: 20px; flex: none; }

/* ---------------- Каркас ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
    width: 258px;
    flex: none;
    background: #1c1f23;
    color: #c8ccd0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 18px;
    border-bottom: 1px solid #2b2f34;
    margin-bottom: 14px;
}
/* Фавикон */
.favicon-preview { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfc; }
.favicon-preview img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line); }

/* Логотип — единый вид на витрине и в админке */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--yellow);
    color: #1c1c1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.logo-mark .icon { width: 26px; height: 26px; }
.logo-img { max-height: 52px; width: auto; display: block; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-size: 21px; font-weight: 800; letter-spacing: -.02em; text-transform: uppercase; color: inherit; }
.logo-text small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.admin-brand .logo-text strong { color: #fff; }
.admin-brand .logo-text small { color: #8b9196; }

.admin-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--yellow);
    color: #1c1c1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 19px;
    flex: none;
}
.admin-brand small { display: block; font-size: 11px; color: #8b9196; }

.admin-nav { display: grid; gap: 3px; }
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 13.5px;
    color: #c4c9ce;
    transition: background .15s, color .15s;
}
.admin-nav-link .icon { width: 18px; height: 18px; opacity: .85; }
.admin-nav-link:hover { background: #262a2f; color: #fff; }
.admin-nav-link.is-active { background: var(--yellow); color: #1b1b1b; font-weight: 600; }
.admin-nav-link.is-active .icon { opacity: 1; }

.admin-side-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid #2b2f34; display: grid; gap: 2px; }
.admin-side-footer form { margin: 0; }
.admin-side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    background: none;
    color: #c4c9ce;
    font: inherit;
    font-size: 13.5px;
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
}
.admin-side-link:hover { background: #262a2f; color: #fff; }
.admin-side-link .icon { width: 17px; height: 17px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.admin-topbar-title { font-size: 16px; font-weight: 700; }
.admin-topbar-user { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #4a4f55; }
.admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--yellow-soft);
    color: #7a5b00;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
}
.admin-content { padding: 24px 26px 60px; display: grid; gap: 18px; }
.admin-alerts { display: grid; gap: 8px; }

/* ---------------- Компоненты ---------------- */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}
.panel-muted { background: #fafbfc; }
.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-hint { font-size: 12.5px; color: var(--muted); }
.panel-foot { display: flex; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.cards-compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    display: grid;
    gap: 4px;
    box-shadow: var(--shadow);
}
.stat-card-accent { background: #1f2328; color: #fff; border-color: #1f2328; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-card-accent .stat-label { color: #b9bec3; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.stat-note { font-size: 12px; color: var(--muted); }
.stat-card-accent .stat-note { color: #a9aeb3; }

.quick-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: grid;
    gap: 2px;
    transition: border-color .15s, transform .15s;
}
.quick-card:hover { border-color: var(--yellow); transform: translateY(-2px); }
.quick-value { font-size: 22px; font-weight: 800; }
.quick-label { font-size: 12px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.grid-2-aside { grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); }

.chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 200px;
    padding-top: 10px;
}
.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    height: 100%;
    min-width: 0;
}
.chart-bar {
    width: 100%;
    max-width: 34px;
    background: linear-gradient(180deg, var(--yellow) 0%, #f9d264 100%);
    border-radius: 5px 5px 2px 2px;
    min-height: 2px;
    transition: height .3s;
}
.chart-col:hover .chart-bar { background: var(--yellow-dark); }
.chart-value { font-size: 10px; color: var(--muted); height: 12px; }
.chart-label { font-size: 10px; color: var(--muted); white-space: nowrap; }

.stat-list { display: grid; gap: 10px; }
.stat-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding-bottom: 9px; border-bottom: 1px dashed #eceef1; }
.stat-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.stat-list span { color: var(--muted); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 600;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 11px 10px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfcfd; }
.table a:hover { text-decoration: underline; text-underline-offset: 2px; }
.td-thumb { width: 62px; }
.td-thumb img { width: 48px; height: 48px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.thumb-empty {
    width: 48px;
    height: 48px;
    border: 1px dashed #d5d8dc;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b6bbc1;
}
.thumb-empty .icon { width: 20px; height: 20px; }

.ta-right { text-align: right; }
.ta-center { text-align: center; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.strikethrough { text-decoration: line-through; }
.inline-form { display: inline; margin: 0; }

.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-on { background: #eaf5ea; color: var(--green); }
.status-off { background: #f2f3f5; color: #7d848b; }
.status-planned { background: var(--yellow-soft); color: #8a6a00; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.pill-red { background: #fdeceb; color: #b03a2e; }

.mini-link {
    display: inline-block;
    font-size: 12.5px;
    color: #3a6ea5;
    border: 0;
    background: none;
    padding: 2px 6px;
    cursor: pointer;
    font-family: inherit;
}
.mini-link:hover { text-decoration: underline; }
.mini-link-danger { color: var(--red); }

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-family: inherit;
}
.link-btn:hover { color: var(--ink); }

/* ---------------- Формы ---------------- */
.admin-form { display: grid; gap: 0; }
.admin-form-compact { gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; align-content: start; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: #484d53; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcdfe3;
    border-radius: 9px;
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 42px; }
.input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(245, 179, 1, .16); }
.input-mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: var(--yellow-dark); width: 16px; height: 16px; flex: none; }
.check-list { display: grid; gap: 7px; max-height: 190px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfc; }
.check-list-tall { max-height: 320px; }
.check-list .check span { line-height: 1.4; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 9px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.btn-primary { background: var(--yellow); color: #1c1c1c; }
.btn-primary:hover { background: var(--yellow-dark); }
.btn-outline { background: #fff; border-color: #d6d9dd; color: var(--ink); }
.btn-outline:hover { border-color: #9aa0a6; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sticky-actions {
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, .94);
    border-top: 1px solid var(--line);
    padding: 12px 0;
    margin-top: 6px;
    backdrop-filter: blur(4px);
    z-index: 5;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar-field { flex: 1; min-width: 180px; }
.toolbar .input { min-width: 0; }

.image-preview {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 8px;
    background: #fbfbfc;
    margin-top: 6px;
}
.image-preview img { max-height: 130px; width: auto; margin: 0 auto; }
.image-preview-sm img { max-height: 80px; }

.logo-preview { border: 1px solid var(--line); border-radius: 9px; padding: 14px; background: #fbfbfc; }
.logo-preview img { max-height: 70px; width: auto; }
.logo-preview-empty { display: flex; align-items: center; gap: 12px; }
.logo-preview-empty strong { display: block; text-transform: uppercase; letter-spacing: -.01em; }
.logo-preview-empty span { font-size: 12px; color: var(--muted); }
.logo-mini {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--yellow);
    color: #1c1c1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 19px;
    flex: none;
}

.repeater { display: grid; gap: 12px; margin-top: 12px; }
.repeater-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border: 1px dashed #dfe2e6;
    border-radius: 10px;
    background: #fbfbfc;
}
.subhead { font-size: 13px; font-weight: 700; margin: 20px 0 8px; color: #2f3439; }
.page-editor {
    padding: 14px 16px;
    border: 1px dashed #dfe2e6;
    border-radius: 10px;
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    background: #fbfbfc;
}
.scope-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; margin-top: 18px; }
.scope-box { display: grid; gap: 8px; align-content: start; }
.scope-box .subhead { margin-top: 0; }

/* ---------------- Уведомления ---------------- */
.alert {
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-success { background: #edf7ed; border-color: #cfe6cf; color: #2b6a2e; }
.alert-error { background: #fdeeee; border-color: #f3cccc; color: #a12d2d; }
.alert-info { background: var(--yellow-soft); border-color: #f3e2b0; color: #7a5b00; }
.empty-text { font-size: 13.5px; color: var(--muted); padding: 12px 0; }
.comment-cell { max-width: 380px; white-space: normal; color: #4a4f55; }

/* База данных */
.radio-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfbfc;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.radio-card:hover { border-color: #c9cdd2; }
.radio-card:has(input:checked) { border-color: var(--yellow); background: #fffdf6; }
.radio-card input { margin: 3px 0 0; accent-color: var(--yellow-dark); }
.radio-card span { display: grid; gap: 2px; }
.radio-card small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.db-fields { border-top: 1px dashed #e2e5e9; margin-top: 8px; padding-top: 4px; }
.db-fields .subhead { margin-top: 12px; }

/* ---------------- Логин ---------------- */
.admin-body-login { background: #1c1f23; }
.admin-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    display: grid;
    gap: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-card h1 { font-size: 22px; font-weight: 800; margin-top: 6px; }
.login-text { font-size: 13.5px; color: var(--muted); }
.login-card .admin-form { gap: 12px; }
.login-card .btn { margin-top: 4px; }
.login-hint {
    background: var(--yellow-soft);
    border: 1px solid #f3e2b0;
    border-radius: 9px;
    padding: 11px 13px;
    display: grid;
    gap: 3px;
    font-size: 12.5px;
    color: #6d5200;
}
.login-hint strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.login-hint code { background: #fff; }
.login-back { font-size: 13px; color: var(--muted); text-align: center; }
.login-back:hover { color: var(--ink); }

/* ---------------- Адаптив ---------------- */
@media (max-width: 1100px) {
    .grid-2-aside { grid-template-columns: 1fr; }
    .scope-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .admin-shell { flex-direction: column; }
.admin-side {
        width: 100%;
        height: auto;
        position: static;
        padding: 12px 16px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }
    .admin-brand { border: 0; margin: 0; padding: 0; flex: 1; }
    .admin-nav { display: flex; overflow-x: auto; gap: 4px; width: 100%; padding-bottom: 2px; }
    .admin-nav-link { white-space: nowrap; }
    .admin-side-footer { margin: 0; border: 0; padding: 0; display: flex; gap: 4px; }
    .admin-side-link span { display: none; }
    .admin-content { padding: 18px 16px 50px; }
    .admin-topbar { padding: 0 16px; }
}
@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .repeater-row { grid-template-columns: 1fr; }
    .chart { height: 160px; gap: 3px; }
    .chart-label { font-size: 8px; transform: rotate(-45deg); }
    .table { display: block; overflow-x: auto; white-space: nowrap; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-value { font-size: 22px; }
    .admin-topbar-title { font-size: 14px; }
}
