﻿:root {
    --sidebar-width-collapsed: 64px;
    --sidebar-width-expanded: 230px;
    --topbar-height: 56px;
    --surface-2: #ffffff;
    --surface-1: #f5f5f3;
    --surface-0: #f0efe9;
    --border-color: #e3e2dc;
    --text-primary: #1f1f1d;
    --text-secondary: #6b6a63;
    --text-muted: #9a988f;
    --accent: #0c447c;
    --accent-bg: #e6f1fb;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--surface-0);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width-collapsed);
    flex-shrink: 0;
    background: var(--surface-2);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow-x: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
}

    .sidebar.expanded {
        width: var(--sidebar-width-expanded);
    }

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
}

    .btn-icon:hover {
        background: var(--surface-1);
    }

.brand-text {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
}

.sidebar.expanded .brand-text {
    opacity: 1;
}

.sidebar-nav {
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

    .nav-item i:not(.nav-caret) {
        font-size: 18px;
        flex-shrink: 0;
        width: 18px;
    }

    .nav-item:hover {
        background: var(--surface-1);
        color: var(--text-primary);
    }

    .nav-item.active {
        background: var(--accent-bg);
        color: var(--accent);
        border-left-color: var(--accent);
    }

.nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.15s;
}

.sidebar.expanded .nav-label {
    opacity: 1;
    width: auto;
}

.nav-caret {
    margin-left: auto;
    font-size: 14px !important;
    transition: transform 0.15s;
    opacity: 0;
}

.sidebar.expanded .nav-caret {
    opacity: 1;
}

.nav-group-toggle.open .nav-caret {
    transform: rotate(90deg);
}

.nav-group {
    display: none;
    flex-direction: column;
    padding: 2px 0 6px;
}

    .nav-group.open {
        display: flex;
    }

.nav-subitem {
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 20px 7px 50px;
    white-space: nowrap;
}

    .nav-subitem:hover {
        background: var(--surface-1);
        color: var(--text-primary);
    }

.sidebar:not(.expanded) .nav-group {
    display: none !important;
}

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    flex-shrink: 0;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.page-title {
    font-size: 15px;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
}

    .user-menu-btn:hover {
        background: var(--surface-1);
    }

    .user-menu-btn::after {
        margin-left: 6px;
    }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.content-body {
    padding: 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 18px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
    }

    .main-area {
        margin-left: var(--sidebar-width-collapsed);
    }
}
