/* ============ Админка ============ */
.adm { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; background: #f4f2ef; }
.adm-side { background: #1c1c1e; color: #cfcfcf; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.adm-side__brand { display: flex; flex-direction: column; gap: 4px; padding: 22px 22px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.adm-side__brand img { width: 130px; }
.adm-side__brand span { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #8a8a8e; }
.adm-side__nav { display: flex; flex-direction: column; padding: 14px 12px; gap: 2px; flex: 1; }
.adm-side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c7c7cc; font-weight: 600; font-size: 14.5px; }
.adm-side__nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.adm-side__nav a.active { background: var(--accent); color: #fff; }
.adm-side__foot { padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.07); }
.adm-side__foot a { color: #8a8a8e; font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }
.adm-side__foot a:hover { color: #fff; }

.adm-main { min-width: 0; display: flex; flex-direction: column; }
.adm-top { display: flex; align-items: center; gap: 14px; padding: 12px 32px; background: #fff; border-bottom: 1px solid #e7e3de; position: sticky; top: 0; z-index: 20; }
.adm-top__spacer { flex: 1; }
.adm-top__user { font-weight: 700; font-size: 14px; color: var(--muted); }
.adm-top__menu { display: none; background: none; border: 0; padding: 6px; color: var(--ink); }
.adm-top form { margin: 0; }
.adm-content { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.adm-backdrop { display: none; }

.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.adm-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.adm-head p { margin: 4px 0 0; }
.adm-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.adm-back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.adm-muted { color: var(--muted); }
.adm-small { font-size: 12.5px; }
.adm-nowrap { white-space: nowrap; }
.adm-loading { padding: 60px; text-align: center; color: var(--muted); }

/* Кнопки */
.adm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; border: 1px solid #ddd8d2; background: #fff;
    color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.adm-btn:hover { border-color: #bdb6ae; color: var(--ink); }
.adm-btn:disabled { opacity: .55; cursor: not-allowed; }
.adm-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.adm-btn--primary:hover:not(:disabled) { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.adm-btn--ghost { background: transparent; }
.adm-btn--danger { background: #d93025; border-color: #d93025; color: #fff; }
.adm-btn--danger:hover { background: #b3261e; color: #fff; }
.adm-btn--danger-ghost { background: transparent; border-color: #f1c4c0; color: #c5221f; }
.adm-btn--danger-ghost:hover { background: #fdecea; color: #c5221f; border-color: #e8a19b; }
.adm-btn--small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.adm-btn--block { width: 100%; }
.adm-icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.adm-icon-btn:hover:not(:disabled) { background: #f0ece7; color: var(--ink); }
.adm-icon-btn:disabled { opacity: .3; cursor: default; }
.adm-icon-btn--danger:hover:not(:disabled) { background: #fdecea; color: #c5221f; }
.adm-link { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 700; font-size: 14px; cursor: pointer; }
.adm-link:hover { color: var(--accent-600); }

/* Карточки и статистика */
.adm-card { background: #fff; border-radius: 14px; border: 1px solid #ebe7e2; padding: 22px; margin-bottom: 20px; }
.adm-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.adm-card__head h2 { font-size: 17px; font-weight: 800; margin: 0; }
.adm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.adm-stat { background: #fff; border: 1px solid #ebe7e2; border-radius: 14px; padding: 18px 20px; display: grid; gap: 2px; color: var(--muted); transition: border-color .2s, transform .2s; }
.adm-stat:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--muted); }
.adm-stat .icon { color: var(--accent); margin-bottom: 6px; }
.adm-stat b { font-size: 30px; color: var(--ink); line-height: 1.1; }
.adm-stat span { font-size: 13.5px; }
.adm-shortcuts { display: flex; gap: 12px; flex-wrap: wrap; }
.adm-shortcuts a { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; background: #fff; border: 1px solid #ebe7e2; border-radius: 12px; color: var(--ink); font-weight: 700; font-size: 14px; }
.adm-shortcuts a:hover { border-color: var(--accent); color: var(--accent); }

/* Таблицы */
.adm-toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
.adm-search { display: flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid #ddd8d2; border-radius: 10px; flex: 1; max-width: 420px; color: var(--muted); }
.adm-search input { border: 0; outline: 0; padding: 10px 0; flex: 1; font: inherit; background: transparent; }
.adm-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225,96,5,.12); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.adm-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid #ebe7e2; }
.adm-table td { padding: 10px; border-bottom: 1px solid #f1eeea; vertical-align: middle; }
.adm-table tr:hover td { background: #fbfaf8; }
.adm-table__thumb { width: 72px; }
.adm-table__thumb img { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; background: #f0ece7; }
.adm-table__thumb--contain img { object-fit: contain; }
.adm-table__title { font-weight: 700; color: var(--ink); }
.adm-table__title:hover { color: var(--accent); }
.adm-table__actions { text-align: right; white-space: nowrap; }
.adm-empty { text-align: center; color: var(--muted); padding: 40px !important; }
.adm-content .pager { margin-top: 20px; }
.adm-content .pager a, .adm-content .pager span { box-shadow: none; border: 1px solid #ebe7e2; height: 36px; min-width: 36px; }

.adm-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.adm-badge--ok { background: #e6f4ea; color: #1e7e34; }
.adm-badge--draft { background: #f1eeea; color: var(--muted); }
.adm-star { border: 0; background: none; font-size: 22px; color: #d6d0c9; cursor: pointer; line-height: 1; }
.adm-star.is-on { color: var(--accent); }

.adm-switch { width: 44px; height: 24px; border-radius: 999px; border: 0; background: #d6d0c9; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; padding: 0; }
.adm-switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.adm-switch.is-on { background: #1e8e3e; }
.adm-switch.is-on span { transform: translateX(20px); }
.adm-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid #f1eeea; }

/* Формы */
.adm-field { display: block; margin-bottom: 18px; }
.adm-field > span { display: block; font-size: 13px; font-weight: 700; color: #4a4e57; margin-bottom: 6px; }
.adm-field > span em { color: var(--accent); font-style: normal; }
.adm-field input:not([type=file]):not([type=checkbox]), .adm-field textarea, .adm-field select,
.adm-pair input, .adm-spec input, .adm-file input {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd8d2; border-radius: 10px;
    font: inherit; font-size: 15px; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.adm-field input:focus, .adm-field textarea:focus, .adm-pair input:focus, .adm-spec input:focus, .adm-file input:focus {
    outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225,96,5,.12);
}
.adm-field textarea { resize: vertical; line-height: 1.55; }
.adm-field .adm-input--lg { font-size: 19px; font-weight: 700; padding: 12px 14px; }
.adm-field--short { max-width: 200px; }
.adm-error { color: #c5221f; font-weight: 600; display: block; margin-top: 4px; }
.adm-prefix { display: flex; align-items: stretch; border: 1px solid #ddd8d2; border-radius: 10px; overflow: hidden; }
.adm-prefix em { white-space: nowrap; font-style: normal; padding: 10px 0 10px 12px; color: var(--muted); font-size: 14px; background: #faf8f6; }
.adm-field .adm-prefix input { min-width: 0; border: 0; border-radius: 0; padding-left: 2px; background: #faf8f6; }
.adm-prefix:focus-within { border-color: var(--accent); }
.adm-field .adm-prefix input:focus { box-shadow: none; }
.adm-pair { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 8px; }
.adm-pair--single { grid-template-columns: 1fr auto; }
.adm-form-grid { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.adm-form-grid--even { grid-template-columns: 1fr 1fr; }
.adm-file { display: flex; gap: 8px; align-items: center; }
.adm-file label { cursor: pointer; }

.adm-editor { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.adm-editor__main { min-width: 0; }
.adm-editor__side { position: sticky; top: 80px; }

.adm-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid #e7e3de; overflow-x: auto; }
.adm-tabs button { background: none; border: 0; padding: 10px 16px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.adm-tabs button.is-active { color: var(--accent); border-color: var(--accent); }

/* Markdown-редактор */
.adm-md { border: 1px solid #ddd8d2; border-radius: 12px; overflow: hidden; background: #fff; }
.adm-md:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225,96,5,.12); }
.adm-md__bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; background: #faf8f6; border-bottom: 1px solid #ebe7e2; flex-wrap: wrap; }
.adm-md__tools { display: flex; align-items: center; gap: 2px; }
.adm-md__tools button, .adm-md__img { min-width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 6px; color: #4a4e57; font-size: 14px; cursor: pointer; position: relative; }
.adm-md__tools button:hover, .adm-md__img:hover { background: #ece7e1; color: var(--ink); }
.adm-md__img input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.adm-md__tools .sep { width: 1px; height: 20px; background: #ddd8d2; margin: 0 4px; }
.adm-md__tabs { display: flex; background: #ece7e1; border-radius: 8px; padding: 2px; }
.adm-md__tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.adm-md__tabs button.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.adm-md textarea { display: block; width: 100%; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; padding: 16px !important; font: 15px/1.65 var(--font) !important; resize: vertical; min-height: 200px; }
.adm-md__preview { padding: 16px 20px; min-height: 200px; }
.adm-md__hint { font-size: 12px; color: var(--muted); padding: 6px 12px; background: #faf8f6; border-top: 1px solid #ebe7e2; }

/* Изображения */
.adm-image { position: relative; border-radius: 12px; overflow: hidden; background: #f4f1ed; }
.adm-image > img { width: 100%; aspect-ratio: 16/10; object-fit: contain; }
.adm-image__actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.adm-image__actions label { cursor: pointer; }
.adm-image__drop, .adm-gallery__add {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
    aspect-ratio: 16/10; border: 2px dashed #d6d0c9; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 14px;
    position: relative; cursor: pointer; transition: border-color .2s, color .2s, background .2s; padding: 12px;
}
.adm-image__drop:hover, .adm-gallery__add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-50); }
.adm-image__drop input, .adm-gallery__add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.adm-image__drop small { font-weight: 500; font-size: 12px; }
.adm-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.adm-gallery__item { position: relative; border-radius: 10px; overflow: hidden; background: #f4f1ed; aspect-ratio: 16/10; }
.adm-gallery__item img { width: 100%; height: 100%; object-fit: contain; }
.adm-gallery__badge { position: absolute; left: 6px; top: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.adm-gallery__tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: center; gap: 4px; padding: 6px; background: linear-gradient(0deg, rgba(0,0,0,.6), transparent); opacity: 0; transition: opacity .2s; }
.adm-gallery__item:hover .adm-gallery__tools { opacity: 1; }
.adm-gallery__tools button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: rgba(255,255,255,.9); display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.adm-gallery__tools button:disabled { opacity: .4; }
.adm-gallery__tools button.danger { color: #c5221f; }
.adm-spinner { width: 26px; height: 26px; border: 3px solid #e7e3de; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Характеристики */
.adm-spec { border: 1px solid #ebe7e2; border-radius: 12px; padding: 14px; margin-bottom: 16px; background: #fcfbfa; }
.adm-spec__head { display: flex; gap: 8px; margin-bottom: 10px; }
.adm-spec .adm-spec__title { font-weight: 700; font-size: 16px; }
.adm-spec__grid { width: 100%; border-collapse: separate; border-spacing: 6px; margin: 0 -6px; }
.adm-spec__grid th { font-size: 12px; text-align: left; color: var(--muted); font-weight: 700; }
.adm-spec__grid input { padding: 8px 10px !important; font-size: 14px !important; }
.adm-spec__narrow { width: 1%; white-space: nowrap; }
.adm-spec__col { display: flex; gap: 4px; }
.adm-spec__col button { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.adm-spec__col button:hover { color: #c5221f; }

/* Списки */
.adm-list { display: grid; gap: 10px; }
.adm-list__row { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid #ebe7e2; border-radius: 12px; padding: 12px 16px; }
.adm-list__main { flex: 1; min-width: 0; display: grid; }
.adm-list__main span { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-avatar { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--slate)); color: #fff; display: grid; place-items: center; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.adm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.adm-avatar--square { border-radius: 12px; background: var(--accent-50); color: var(--accent); }
.adm-logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.adm-logo { background: #fff; border: 1px solid #ebe7e2; border-radius: 12px; padding: 14px; display: grid; gap: 2px; text-align: center; }
.adm-logo__img { height: 80px; display: grid; place-items: center; margin-bottom: 8px; }
.adm-logo__img img { max-height: 70px; max-width: 150px; width: auto; }
.adm-logo b { font-size: 14px; }
.adm-logo__tools { display: flex; justify-content: center; gap: 2px; margin-top: 8px; }

/* Модальные окна и уведомления */
.adm-modal { position: fixed; inset: 0; z-index: 300; background: rgba(20,20,24,.5); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.adm-modal__box { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 440px; box-shadow: 0 30px 80px rgba(0,0,0,.3); max-height: calc(100vh - 40px); overflow-y: auto; }
.adm-modal__box--wide { max-width: 680px; }
.adm-modal__box h3 { font-size: 19px; font-weight: 800; }
.adm-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.adm-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: grid; gap: 10px; }
.adm-toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px; background: #1c1c1e; color: #fff; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: toast-in .25s ease; }
.adm-toast--ok .icon { color: #4cd964; }
.adm-toast--error { background: #b3261e; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* Вход */
.adm-login {
    min-height: 100vh; display: grid; place-items: center; padding: 20px;
    background: linear-gradient(180deg, rgba(20,22,32,.55), rgba(20,22,32,.85)), url("img/bg.jpg") center / cover;
}
.adm-login__card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 36px 32px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.adm-login__logo { width: 150px; margin: 0 auto 18px; }
.adm-login h1 { text-align: center; font-size: 22px; font-weight: 800; margin: 0; }
.adm-login__sub { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 24px; }
.adm-login__back { display: block; text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.adm-alert { background: #fdecea; color: #b3261e; padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; margin-bottom: 16px; }

/* Адаптив админки */
@media (max-width: 1100px) {
    .adm-editor { grid-template-columns: 1fr; }
    .adm-editor__side { position: static; }
    .adm-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .adm { grid-template-columns: 1fr; }
    .adm-side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 100; transform: translateX(-100%); transition: transform .25s; }
    .adm--menu .adm-side { transform: none; }
    .adm--menu .adm-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; }
    .adm-top { padding: 10px 16px; }
    .adm-top__menu { display: block; }
    .adm-content { padding: 20px 16px 48px; }
    .adm-form-grid { grid-template-columns: 1fr; }
    .adm-table th:nth-child(3), .adm-table td:nth-child(3) { display: none; }
    .adm-table__thumb { display: none; }
}

/* Языки, загрузки */
.adm-lang { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid #f1eeea; }
.adm-lang button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #ddd8d2; background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.adm-lang button.is-active { background: #1c1c1e; border-color: #1c1c1e; color: #fff; }
.adm-lang__state { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: #f1eeea; color: var(--muted); }
.adm-lang__state.is-ok { background: #e6f4ea; color: #1e7e34; }
.adm-lang__hint { flex-basis: 100%; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.adm-badge--en { background: #e8eefc; color: #2f54b3; margin-left: 6px; font-size: 10.5px; padding: 1px 6px; vertical-align: middle; }
.adm-card--note { font-size: 14px; color: #4a4e57; margin-top: 20px; line-height: 1.6; }
.adm-card code, .adm-head code { background: #f1eeea; padding: 1px 6px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }
.adm-error-text { color: #c5221f; font-weight: 700; }
.adm-progress { height: 6px; background: #f1eeea; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.adm-progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.adm-toggle-row--flat { border: 0; padding: 0; margin: 4px 0 0; }
.adm-btn.is-disabled { opacity: .5; pointer-events: none; }
.adm-list__row .adm-badge { flex-shrink: 0; }
