/* ============================================================
   PRIME LEGAL — админ-панель
   ============================================================ */
:root {
    --navy-900: #0a1526;
    --navy-800: #0e1c33;
    --navy-700: #16294a;
    --gold: #c99a3f;
    --gold-600: #b3852f;
    --gold-100: #f6ecd6;
    --ink: #16202e;
    --muted: #6a7789;
    --line: #e5e9f0;
    --bg: #f4f6fa;
    --white: #fff;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 18px 50px -22px rgba(14,28,51,.3);
    --shadow-sm: 0 6px 20px -10px rgba(14,28,51,.25);
    --ok: #1f9254;
    --err: #d23b3b;
    --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --ease: cubic-bezier(.22,.61,.36,1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Кнопки ---------- */
.btn-admin {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
    transition: background .2s, transform .15s, box-shadow .2s, color .2s, border-color .2s;
}
.btn-admin:active { transform: translateY(1px); }
.btn-admin-primary { background: var(--gold); color: var(--navy-900); }
.btn-admin-primary:hover { background: var(--gold-600); }
.btn-admin-ghost { background: var(--white); color: var(--navy-800); border-color: var(--line); }
.btn-admin-ghost:hover { border-color: var(--gold); color: var(--gold-600); }
.btn-admin-danger { background: #fff; color: var(--err); border-color: #f0c7c7; }
.btn-admin-danger:hover { background: #fdeaea; }
.btn-admin-block { width: 100%; }
.btn-admin-sm { padding: 8px 14px; font-size: 13px; }

/* ---------- Страница входа ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(140deg, var(--navy-900), var(--navy-700)); }
.login-card { width: 100%; max-width: 400px; background: var(--white); border-radius: 18px; padding: 42px 38px; box-shadow: var(--shadow); text-align: center; }
.login-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--navy-800); margin-bottom: 22px; }
.login-logo svg { width: 30px; height: 30px; color: var(--gold); }
.login-card h1 { font-family: var(--font-display); font-size: 26px; color: var(--navy-800); }
.login-sub { color: var(--muted); font-size: 14px; margin: 8px 0 26px; }
.login-back { display: inline-block; margin-top: 20px; font-size: 13px; color: var(--muted); }
.login-back:hover { color: var(--gold-600); }

/* ---------- Формы ---------- */
.admin-form { text-align: left; }
.af-field { display: block; margin-bottom: 16px; }
.af-field > span { display: block; font-size: 13px; font-weight: 600; color: var(--navy-800); margin-bottom: 6px; }
.af-field input, .af-group input, .af-group textarea, .af-lang input, .af-lang textarea, .af-select {
    width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; color: var(--ink); background: #fafbfd; transition: border-color .2s, background .2s;
}
.af-field input:focus, .af-group input:focus, .af-group textarea:focus, .af-lang input:focus, .af-lang textarea:focus, .af-select:focus {
    outline: none; border-color: var(--gold); background: #fff;
}
textarea { resize: vertical; }
.af-group { margin-bottom: 20px; }
.af-label { display: block; font-size: 14px; font-weight: 700; color: var(--navy-800); margin-bottom: 8px; }
.af-hint { font-weight: 500; font-size: 12px; color: var(--muted); }
.af-bilingual { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.af-lang { position: relative; }
.af-lang-tag { position: absolute; top: -9px; left: 10px; background: var(--gold-100); color: var(--gold-600); font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 2px 7px; border-radius: 5px; }
.af-lang input, .af-lang textarea { padding-top: 14px; }

/* ---------- Алерты ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.alert-error { background: #fdeaea; color: var(--err); }
.alert-success { background: #e7f6ee; color: var(--ok); }

/* ---------- Layout ---------- */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-800); color: #fff; padding: 26px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 30px; padding: 0 8px; }
.sidebar-logo svg { width: 28px; height: 28px; color: var(--gold); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: rgba(255,255,255,.72); transition: background .2s, color .2s; }
.side-nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: var(--gold); color: var(--navy-900); }
.side-foot { margin-top: auto; padding-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.side-foot a { font-size: 13px; color: rgba(255,255,255,.6); padding: 8px 14px; border-radius: var(--radius-sm); transition: color .2s, background .2s; }
.side-foot a:hover { color: #fff; background: rgba(255,255,255,.07); }

.admin-main { padding: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 34px; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-topbar h1 { font-family: var(--font-display); font-size: 24px; color: var(--navy-800); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.admin-user { font-size: 13px; color: var(--muted); }
.admin-content { padding: 30px 34px 60px; max-width: 1000px; }

/* ---------- Панели / карточки ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-head h2 { font-size: 18px; color: var(--navy-800); }
.panel-head .badge { background: var(--gold-100); color: var(--gold-600); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 6px; }
.panel-sub { color: var(--muted); font-size: 13px; margin-top: -12px; margin-bottom: 18px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; position: sticky; bottom: 0; }

/* ---------- Повторяющиеся элементы (услуги, faq и т.д.) ---------- */
.repeat-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px; margin-bottom: 16px; background: #fafbfd; position: relative; }
.repeat-item .repeat-num { position: absolute; top: -10px; left: 16px; background: var(--navy-800); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 5px; }
.repeat-remove { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 1px solid var(--line); color: var(--err); font-size: 18px; line-height: 1; display: grid; place-items: center; cursor: pointer; }
.repeat-remove:hover { background: #fdeaea; }
.add-item-btn { border: 1.5px dashed var(--line); background: #fafbfd; color: var(--gold-600); }
.add-item-btn:hover { border-color: var(--gold); background: var(--gold-100); }

/* ---------- Выбор иконки ---------- */
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin-top: 6px; }
.icon-opt { border: 1.5px solid var(--line); border-radius: 8px; padding: 9px; background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--navy-700); transition: all .15s; }
.icon-opt svg { width: 22px; height: 22px; }
.icon-opt:hover { border-color: var(--gold); }
.icon-opt.selected { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }

/* ---------- Загрузка изображений ---------- */
.img-upload { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.img-preview { width: 130px; height: 90px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--line); background: #fafbfd; }
.img-upload-controls { flex: 1; min-width: 220px; }
.file-input-wrap { position: relative; overflow: hidden; display: inline-block; }
.file-input-wrap input[type=file] { position: absolute; left: 0; top: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- Переключатель ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: none; }
.switch-row .sr-label { font-weight: 600; font-size: 14px; color: var(--navy-800); }
.switch-row .sr-label small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cdd5e0; border-radius: 20px; transition: .25s; }
.switch .slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--gold); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Таблица заявок ---------- */
.subs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.subs-table th, .subs-table td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.subs-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.subs-table tr:hover td { background: #fafbfd; }
.sub-source { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px; background: var(--gold-100); color: var(--gold-600); }
.sub-phone a { font-weight: 600; color: var(--navy-800); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }

/* ---------- Статистика ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.stat-card .sc-num { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--navy-800); }
.stat-card .sc-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat-card .sc-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--gold-100); color: var(--gold-600); display: grid; place-items: center; margin-bottom: 14px; }
.stat-card .sc-icon svg { width: 24px; height: 24px; }

/* ---------- Мобильное меню админки ---------- */
.side-toggle { display: none; }
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .3s var(--ease); }
    .sidebar.open { transform: translateX(0); }
    .side-toggle { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 9px; background: var(--navy-800); color: #fff; }
    .side-toggle svg { width: 22px; height: 22px; }
    .admin-topbar { padding: 16px 18px; }
    .admin-content { padding: 20px 18px 50px; }
    .grid-2, .af-bilingual { grid-template-columns: 1fr; }
    .backdrop { position: fixed; inset: 0; background: rgba(10,21,38,.5); z-index: 55; }
    .backdrop[hidden] { display: none; }
}
.icon {
    max-width: 40px;
}
.side-foot a {
    display: flex;
    align-items: center;
}