@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    --ink: #0F1B2D;
    --navy-deep: #0E2647;
    --teal: #2FB6C4;
    --paper: #F3F5F7;
    --surface: #FFFFFF;
    --line: #E1E6EA;
    --muted: #64707C;
    --danger: #C0392B;
    --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Manrope', sans-serif; background: var(--paper); color: var(--ink); }
a { color: var(--navy-deep); text-decoration: none; }
.mono { font-family: 'JetBrains Mono', monospace; }

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--navy-deep);
    color: #fff;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.admin-brand { font-weight: 800; font-size: 1.05rem; margin-bottom: 24px; padding: 0 8px; }
.admin-brand span { display: block; font-weight: 500; font-size: 0.75rem; color: rgba(255,255,255,0.55); margin-top: 2px; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.admin-sidebar nav a {
    color: rgba(255,255,255,0.78);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-sidebar nav a.active { background: var(--teal); color: var(--navy-deep); }
.badge { background: var(--danger); color: #fff; font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; }
.admin-sidebar-footer { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 14px; margin-top: 14px; }
.admin-sidebar-footer a { color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.admin-sidebar-footer a:hover { color: #fff; }

.admin-main { flex: 1; padding: 36px 40px; max-width: 1100px; }

.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-header h1 { margin: 0; font-size: 1.5rem; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px; border-radius: 8px; border: none;
    font-weight: 700; font-size: 0.88rem; cursor: pointer;
    font-family: inherit;
}
.btn-primary { background: var(--teal); color: var(--navy-deep); }
.btn-primary:hover { background: #4FD8E6; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #EEF1F3; }
.btn-danger { background: #FCEBEA; color: var(--danger); }
.btn-danger:hover { background: #F8D7D4; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 0 var(--line); }
th, td { padding: 12px 14px; text-align: left; font-size: 0.9rem; border-bottom: 1px solid var(--line); }
th { background: #F8FAFB; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.actions { display: flex; gap: 8px; white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }

.form-grid { display: grid; gap: 16px; max-width: 620px; }
.field label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; }
.field input, .field textarea, .field select {
    width: 100%; padding: 11px 12px; border-radius: 8px; border: 1.5px solid var(--line);
    font-family: inherit; font-size: 0.92rem; background: #fff;
}
.field textarea { min-height: 100px; resize: vertical; }
.field-hint { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; }
.checkbox-field input { width: auto; }

.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; background: #EEF1F3; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-weight: 600; font-size: 0.9rem; }
.alert-success { background: rgba(47,182,196,0.14); color: var(--navy-deep); }
.alert-error { background: #FCEBEA; color: var(--danger); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat-card .num { font-size: 1.8rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.stat-card .label { color: var(--muted); font-size: 0.85rem; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy-deep); }
.login-card { background: #fff; padding: 40px; border-radius: 14px; width: 340px; }
.login-card h1 { font-size: 1.2rem; margin: 0 0 4px; }
.login-card p { color: var(--muted); font-size: 0.85rem; margin: 0 0 20px; }

/* ============================== КАДРИРОВАНИЕ ФОТО ============================== */

.crop-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 45, 0.72);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.crop-modal.open { display: flex; }
.crop-modal-inner {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}
.crop-modal-inner h3 { margin: 0 0 6px; }
.crop-modal-image-wrap {
    max-height: 55vh;
    overflow: hidden;
    margin: 16px 0;
    background: #111;
    border-radius: 8px;
}
.crop-modal-image-wrap img { display: block; max-width: 100%; }
.crop-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 800px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
    .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .admin-main { padding: 20px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
