﻿/* === BASE === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

.user-pill .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: .5rem;
}

/* === TOKENS === */
:root {
    --sidebar-w: 260px;
    --topbar-h: 56px;
    --topbar-gap-right: 48px;
    --radius: 10px;
}

html[data-bs-theme="light"] {
    --bs-body-bg: #f7f8fa; /* мягкий фон */
    --bs-body-color: #111827; /* почти чёрный текст */
    --bs-secondary-bg: #ffffff; /* карточки/панели */
    --bs-tertiary-bg: #f1f3f7; /* hover/soft */
    --bs-border-color: #e5e7eb; /* светлая граница */
    --bs-secondary-color: #6b7280; /* вторичный текст */
    --bs-link-color: #0d6efd;
    --bcb-border-color: #cccdd0; /* бордеры для чекбоксов таблиц */
}

/*
html[data-bs-theme="dark"] { ... }
*/

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === SIDEBAR === */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bs-secondary-bg);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    gap: 12px;
    z-index: 1040;
}

.brand {
    font-weight: 700;
    letter-spacing: .4px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

    .brand .logo {
        width: 200px;
        height: 100px;
        display: grid;
        place-items: center;
        border-radius: 6px;
    }

/* =========================================================
   NAV
   ========================================================= */

.nav-vertical [data-bs-toggle="collapse"][aria-expanded="true"] .collapse-caret {
    transform: rotate(90deg);
}

.nav-vertical .nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.nav-vertical .nav-sub {
    padding-left: 12px;
    border-left: 1px dashed var(--bs-border-color);
    margin-left: 8px;
}

    .nav-vertical .nav-sub a {
        display: block;
        padding: 6px 10px;
        border-radius: 8px;
        margin: 2px 0;
    }

.nav-vertical .collapse-caret {
    transition: transform .2s ease;
}

.nav-vertical .rotate-90 {
    transform: rotate(90deg);
}

.nav-vertical {
    margin-top: 8px;
    display: grid;
    gap: 4px;
}

    .nav-vertical a, .nav-vertical button {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 8px;
        text-decoration: none;
        color: inherit;
        transition: background-color .15s ease, color .15s ease, border-color .15s ease;
    }

        .nav-vertical a:hover,
        .nav-vertical a.active,
        .nav-vertical button:hover {
            background: var(--bs-tertiary-bg);
        }

.nav-bottom {
    margin-top: auto;
    border-top: 1px dashed var(--bs-border-color);
    padding-top: 8px;
}

.app-sidebar {
    overflow-y: auto;
}

.sidebar-footer {
    font-size: .9rem;
    color: var(--bs-secondary-color);
    border-top: 1px dashed var(--bs-border-color);
    padding-top: 10px;
}

/* === CONTENT === */
.app-wrap {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === TOP STRIP === */
.top-strip {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0 var(--radius) var(--radius) 0;
    width: calc(100% - var(--topbar-gap-right));
    margin: 16px 0 12px 0;
    padding: 0 12px 0 16px;
    border-left: 0;
}

    .top-strip .title {
        font-weight: 600;
    }

.top-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-chrome {
    border: 1px solid var(--bs-border-color);
    background: transparent;
    color: inherit;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

    .btn-chrome:hover {
        background: var(--bs-tertiary-bg);
    }

/* === MAIN === */
.app-content {
    flex: 1 1 auto;
    padding: 12px 16px 0 16px;
    display: flex;
    justify-content: center;
    justify-content: flex-start;
    flex-direction: column;
}

/* === MISC === */
.user-pill {
    padding: 6px 10px;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

/* === MOBILE / TABLET === */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 992px) {
    :root {
        --sidebar-w: min(86vw, 320px);
        --topbar-gap-right: 12px;
    }

    .app-wrap {
        margin-left: 0;
    }

    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: none;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 0 0 0 1px var(--bs-border-color), 0 10px 30px rgba(0,0,0,.15);
    }

    /* бэкдроп */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.35);
        backdrop-filter: blur(1px);
        z-index: 1030;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    body.no-scroll {
        overflow: hidden;
    }
}

/* =========================================================
   TOASTS
   ========================================================= */
.toast {
    display: block;
    background: #141a23;
    border-radius: 10px;
}

.text-bg-success {
    background: #198754;
}

.text-bg-danger {
    background: #dc3545;
}

.text-bg-warning {
    background: #ff6507;
}
