:root {
    --bg: #0e1116;
    --bg-2: #151a22;
    --bg-3: #1b222c;
    --line: #262d37;
    --text: #e8edf3;
    --muted: #7f8a9b;
    --primary: #4c8dff;
    --primary-2: #3b75db;
    --success: #25c07b;
    --warn: #e5b030;
    --danger: #e8524a;
    --vk: #0077ff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.topbar {
    background: linear-gradient(180deg, #141922 0%, #10151d 100%);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.topbar .wrap { display: flex; align-items: center; gap: 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; letter-spacing: .2px; }
.brand span { color: var(--muted); font-weight: 500; margin-left: 6px; }
nav { display: flex; gap: 4px; margin-left: 12px; }
.nav-link { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav-link:hover { color: var(--text); background: var(--bg-2); }
.nav-primary { color: var(--primary); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userbox img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.inline { display: inline; }

main.wrap { padding-top: 32px; padding-bottom: 64px; }

h1 { font-size: 26px; font-weight: 700; margin: 0 0 20px; }
h2.section-title { font-size: 18px; font-weight: 600; margin: 32px 0 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); }

.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; }
.page-head h1 { margin: 0; }

.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    background: var(--bg-3); color: var(--text);
    border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 16px; font-size: 14px; font-weight: 500; cursor: pointer;
    text-decoration: none; transition: 0.15s;
}
.btn:hover { background: #232b36; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-success { background: #1b7a4f; border-color: #1b7a4f; color: #fff; }
.btn-success:hover { background: #259461; }
.btn-warn { background: #8a6b13; border-color: #8a6b13; color: #fff; }
.btn-warn:hover { background: #a6821d; }
.btn-danger { background: #8a2f2a; border-color: #8a2f2a; color: #fff; }
.btn-danger:hover { background: #a23b35; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-2); }
.btn-vk { background: var(--vk); border-color: var(--vk); color: #fff; padding: 12px 22px; font-size: 15px; }
.btn-vk:hover { background: #005fcc; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.alert-error { background: #3a1a19; color: #ffbab7; border: 1px solid #6b2723; }
.storage-note { background: #162236; color: #a3caff; border: 1px solid #284068; }

.auth-card {
    max-width: 380px; margin: 80px auto; padding: 32px; text-align: center;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-card h1 { margin-top: 0; font-size: 22px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card {
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
}
.stat-card > span { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card strong { font-size: 28px; font-weight: 700; }
[data-live-stat] { transition: color 0.18s ease, text-shadow 0.18s ease; }
[data-live-stat].stat-updated {
    color: #79b1ff;
    text-shadow: 0 0 16px rgba(121, 177, 255, 0.45);
}

.tbl { width: 100%; border-collapse: collapse; background: var(--bg-2); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--bg-3); color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl a { color: var(--primary); text-decoration: none; }
.tbl a:hover { text-decoration: underline; }
.tbl td.type-map    { color: #8acfff; }
.tbl td.type-mod    { color: #ff9af5; }
.tbl td.type-addon  { color: #b4f58a; }
.tbl td.type-skin   { color: #f5c78a; }
.tbl td.type-texture{ color: #c78aff; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
    background: var(--bg-3); color: var(--muted); border: 1px solid var(--line);
}
.badge-admin { color: #ffd65e; border-color: #4e4223; background: #2a230f; }
.badge-moderator { color: #a3caff; border-color: #284068; background: #162236; }
.badge-draft { color: #e5b030; border-color: #4e4223; background: #2a230f; }
.badge-published { color: #25c07b; border-color: #1f4a36; background: #122219; }
.badge-rejected { color: #e8524a; border-color: #542623; background: #2a1816; }

.tag { padding: 3px 8px; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.tag-free { color: var(--success); }

.filters { display: flex; gap: 10px; margin-bottom: 18px; }
.filters select, .filters input { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 14px; }

.form { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { color: var(--muted); font-size: 13px; font-weight: 500; }
.form-row input[type=text], .form-row input[type=number], .form-row textarea, .form-row select {
    background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14px; font: inherit;
}
.form-row textarea { resize: vertical; min-height: 120px; }
.form-row input[type=file] { color: var(--muted); font-size: 13px; }
.form-row-inline { display: flex; flex-direction: row; gap: 20px; align-items: flex-end; }
.form-row-inline label { display: flex; flex-direction: column; gap: 6px; }
.checkbox { flex-direction: row !important; align-items: center; gap: 8px; color: var(--text) !important; font-size: 14px !important; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }

.upload-progress {
    background: var(--bg-3);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
}
.upload-progress[hidden] { display: none; }
.upload-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.upload-progress-head strong {
    font-size: 14px;
    font-weight: 600;
}
.upload-progress-head span {
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.upload-progress-bar {
    width: 100%;
    height: 10px;
    overflow: hidden;
    background: #10151d;
    border: 1px solid var(--line);
    border-radius: 999px;
}
.upload-progress-bar span {
    display: block;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #25c07b);
    border-radius: inherit;
    transition: width 0.18s ease;
}
.upload-progress small {
    display: block;
    margin-top: 8px;
}
.upload-progress.is-processing .upload-progress-bar span {
    background: linear-gradient(90deg, var(--primary), #25c07b, var(--primary));
    background-size: 200% 100%;
    animation: uploadFlow 1.2s linear infinite;
}
.upload-progress.is-error {
    background: #3a1a19;
    border-color: #6b2723;
}
.upload-progress.is-error .upload-progress-head strong,
.upload-progress.is-error .upload-progress-head span,
.upload-progress.is-error small {
    color: #ffbab7;
}
@keyframes uploadFlow {
    from { background-position: 0% 0; }
    to { background-position: 200% 0; }
}

.thumb-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.counters-row {
    background: var(--bg-3);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    gap: 16px;
    align-items: end;
}
.counters-row label { gap: 4px !important; }
.counters-row input[type=number] {
    background: var(--bg-2); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px;
    padding: 8px 10px; font-size: 14px; width: 120px;
}
.hidden-form { display: none; }

.counter-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    background: var(--bg-3); border: 1px solid var(--line);
    font-size: 12px; color: var(--muted);
}
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tbl code {
    color: var(--text);
    background: var(--bg-3);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 6px;
    word-break: break-all;
}
.storage-provider-block[hidden] { display: none; }
.storage-form .form-row-inline > label { flex: 1; min-width: 220px; }

/* ============== Dashboard ============== */
.stat-card.stat-good   strong { color: var(--success); }
.stat-card.stat-warn   strong { color: var(--warn); }
.stat-card.stat-bad    strong { color: var(--danger); }
.stat-card.stat-online {
    background: linear-gradient(180deg, #142622 0%, #122019 100%);
    border-color: #1f4a36;
}
.stat-card.stat-online strong { color: var(--success); display: inline-flex; align-items: center; gap: 8px; }

.pulse-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(37, 192, 123, 0.6);
    animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 192, 123, 0.6); }
    70%  { box-shadow: 0 0 0 10px rgba(37, 192, 123, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 192, 123, 0); }
}

.chart-card {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 18px;
}
.chart-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 14px;
}
.chart-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.chart-head .muted { font-size: 12px; }
.chart-svg {
    display: block;
    width: 100%;
    height: auto;
}
