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

:root {
    --bg: #080810;
    --bg-soft: #0d0d18;
    --panel: #11111f;
    --panel-hover: #171729;
    --border: rgba(255,255,255,.07);
    --text: #f4f2ff;
    --muted: #85839c;
    --purple: #8b5cf6;
    --purple-light: #a78bfa;
    --purple-dark: #6d28d9;
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f59e0b;
    --radius: 16px;
    --shadow: 0 15px 45px rgba(0,0,0,.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 10% 0%, rgba(109,40,217,.13), transparent 35%),
        radial-gradient(ellipse at 100% 100%, rgba(139,92,246,.08), transparent 35%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

/* ОСНОВНАЯ СТРУКТУРА */

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

.sidebar {
    width: 255px;
    min-width: 255px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    padding: 25px 16px;
    background: rgba(13,13,24,.96);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
}

.main {
    width: calc(100% - 255px);
    min-height: 100vh;
    margin-left: 255px;
    padding: 30px 35px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 30px;
}

.brand-logo {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #a78bfa, #6d28d9);
    box-shadow: 0 5px 25px rgba(139,92,246,.35);
    color: white;
    font-size: 19px;
    font-weight: 900;
}

.brand-name {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -.5px;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 10px;
    margin-top: 4px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.sidebar-title {
    padding: 15px 12px 10px;
    color: #66647d;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-link {
    min-height: 43px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 13px;
    border-radius: 11px;
    color: #9290a8;
    font-size: 13px;
    font-weight: 600;
    transition: .2s;
}

.nav-link:hover {
    background: rgba(139,92,246,.09);
    color: white;
    transform: translateX(2px);
}

.nav-link.active {
    color: white;
    background: linear-gradient(100deg, rgba(139,92,246,.24), rgba(109,40,217,.08));
    box-shadow: inset 3px 0 var(--purple-light);
}

.sidebar-bottom {
    margin-top: auto;
    padding: 15px 5px 0;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
}

.user-avatar {
    width: 37px;
    height: 37px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, #8b5cf6, #4c1d95);
    color: white;
    font-weight: 800;
}

.user-info {
    min-width: 0;
}

.user-info strong {
    display: block;
    font-size: 12px;
}

.user-info span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

/* ШАПКА */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 30px;
}

.page-title {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -.8px;
}

.page-description {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* КАРТОЧКИ */

.card {
    padding: 22px;
    background: linear-gradient(145deg, #151525, #10101b);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: .2s;
}

.card:hover {
    border-color: rgba(167,139,250,.2);
}

.card-title {
    margin-bottom: 17px;
    font-size: 14px;
    font-weight: 800;
}

.stats-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 22px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 21px;
    background: linear-gradient(145deg, #171729, #10101b);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat-card::after {
    content: "";
    position: absolute;
    width: 100px;
    height: 100px;
    right: -35px;
    top: -35px;
    background: rgba(139,92,246,.12);
    filter: blur(25px);
    border-radius: 50%;
}

.stat-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.stat-value {
    margin-top: 13px;
    font-size: 29px;
    font-weight: 900;
    letter-spacing: -1px;
}

.stat-icon {
    color: var(--purple-light);
    font-size: 20px;
}

/* КНОПКИ */

.btn,
button[type="submit"] {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    font-size: 12px;
    font-weight: 800;
    transition: .2s;
}

.btn:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(139,92,246,.25);
}

.btn-secondary {
    background: #1b1b2c;
    border-color: var(--border);
    color: #d7d3e8;
}

.btn-danger {
    background: rgba(239,68,68,.12);
    border-color: rgba(239,68,68,.2);
    color: #ff7777;
}

/* ФОРМЫ */

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    padding: 11px 13px;
    outline: none;
    background: #0b0b15;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 10px;
    color: white;
    font-size: 12px;
    transition: .2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(139,92,246,.1);
}

input::placeholder,
textarea::placeholder {
    color: #66647c;
}

select option {
    background: #151525;
    color: white;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #aaa7bd;
    font-size: 11px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 17px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

/* ТАБЛИЦЫ */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th {
    padding: 14px 16px;
    background: rgba(255,255,255,.035);
    color: #88859e;
    font-size: 10px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .7px;
}

td {
    padding: 15px 16px;
    border-top: 1px solid var(--border);
    color: #d9d6e8;
    font-size: 12px;
}

tr:hover td {
    background: rgba(139,92,246,.035);
}

/* СТАТУСЫ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 7px;
    background: rgba(139,92,246,.12);
    color: #bda5ff;
    font-size: 10px;
    font-weight: 800;
}

.badge-success {
    background: rgba(34,197,94,.1);
    color: #4ade80;
}

.badge-danger {
    background: rgba(239,68,68,.1);
    color: #f87171;
}

.badge-warning {
    background: rgba(245,158,11,.1);
    color: #fbbf24;
}

/* РАЗДЕЛЫ */

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.empty-state {
    padding: 45px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state strong {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-size: 15px;
}

.alert {
    padding: 13px 15px;
    margin-bottom: 17px;
    border-radius: 10px;
    font-size: 12px;
}

.alert-success {
    background: rgba(34,197,94,.1);
    border: 1px solid rgba(34,197,94,.2);
    color: #4ade80;
}

.alert-error {
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.2);
    color: #f87171;
}

/* СТРАНИЦА АВТОРИЗАЦИИ */

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 50% 20%, rgba(139,92,246,.2), transparent 35%),
        var(--bg);
}

.auth-box {
    width: 100%;
    max-width: 410px;
    padding: 35px;
    background: rgba(17,17,31,.95);
    border: 1px solid rgba(167,139,250,.16);
    border-radius: 22px;
    box-shadow: 0 25px 80px rgba(0,0,0,.45);
}

.auth-title {
    margin-bottom: 9px;
    font-size: 25px;
    font-weight: 900;
}

.auth-description {
    margin-bottom: 27px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

/* АДАПТИВНОСТЬ */

@media (max-width: 1100px) {
    .stats-grid,
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main {
        padding: 25px 22px;
    }
}

@media (max-width: 760px) {
    .sidebar {
        width: 70px;
        min-width: 70px;
        padding: 18px 9px;
    }

    .brand {
        justify-content: center;
        padding: 0 0 25px;
    }

    .brand-name,
    .brand-subtitle,
    .sidebar-title,
    .nav-link span,
    .user-info {
        display: none;
    }

    .nav-link {
        justify-content: center;
        padding: 0;
        font-size: 18px;
    }

    .user-card {
        justify-content: center;
        padding: 8px 0;
    }

    .main {
        width: calc(100% - 70px);
        margin-left: 70px;
        padding: 20px 13px;
    }

    .page-title {
        font-size: 21px;
    }

    .content-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px;
    }
}

@media (max-width: 430px) {
    .stats-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .auth-box {
        padding: 25px 20px;
    }
}
