/* === Reset & Variables === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-green: #2ECC40;
    --primary-green-dark: #27ae36;
    --primary-blue: #1976D2;
    --bg: #FAFBFC;
    --surface: #FFFFFF;
    --text: #2D3748;
    --text-secondary: #718096;
    --border: #E2E8F0;
    --danger: #E53E3E;
    --warning: #DD6B20;
    --success: #2ECC40;
    --info: #1976D2;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --radius: 8px;
    --radius-sm: 4px;
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Layout === */
.layout {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.2s;
}

/* Logo area - blends with logo background */
.sidebar-logo-area {
    padding: 16px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    filter: drop-shadow(0 1px 4px rgba(0,0,0,0.06));
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.sidebar-nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #A0AEC0;
    padding: 16px 20px 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    margin: 2px 10px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s;
    text-decoration: none;
}

.sidebar-nav a:hover {
    background: #F7FAFC;
    color: var(--text);
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--primary-green-dark);
    background: linear-gradient(135deg, rgba(46,204,64,0.08), rgba(46,204,64,0.04));
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary-green);
}

.sidebar-nav a svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-nav a.active svg {
    opacity: 1;
    stroke: var(--primary-green-dark);
}

.sidebar-nav a span {
    flex: 1;
}

/* Sidebar footer - user info */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: #FAFBFC;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.sidebar-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* === Main Content === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text);
}

.page-content {
    flex: 1;
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

/* === Impersonation Banner === */
.impersonation-banner {
    background: #FFFBEB;
    border-bottom: 2px solid #F59E0B;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #92400E;
}

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-menu {
        display: block;
    }

    .page-content {
        padding: 16px;
    }
}
