/* ===== THEME VARIABLES ===== */
:root {
    --accent:       #3b6ea5;
    --accent-dark:  #2d5a8e;
    --accent-light: #ebf2fa;
    --accent-xlight:#f4f8fd;
    --bg-page:      #f2f5f9;
    --bg-card:      #ffffff;
    --border:       #dde3ec;
    --border-light: #edf0f5;
    --text-primary: #1a2433;
    --text-secondary:#475569;
    --text-muted:   #8496ad;
}

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

/* ===== LAYOUT ===== */
body {
    font-family: 'Figtree';
    display: block;
    height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 52px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 300;
    overflow: hidden;
    transition: width 0.22s ease, box-shadow 0.22s ease;
}

body:not(.sidebar-pinned) .sidebar:hover {
    width: 250px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.09);
}
body.sidebar-pinned .sidebar {
    width: 250px;
}

/* ── Sidebar header (logo + pin button) ─── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    min-height: 56px;
    flex-shrink: 0;
    overflow: hidden;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.logo-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
}

/* Pin button */
.sidebar-pin-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
body:not(.sidebar-pinned) .sidebar:hover .sidebar-pin-btn,
body.sidebar-pinned .sidebar-pin-btn {
    opacity: 1;
}
.sidebar-pin-btn:hover {
    color: var(--accent);
    background: var(--accent-xlight);
}
body.sidebar-pinned .sidebar-pin-btn {
    color: var(--accent);
}

/* ── Nav labels (hidden when collapsed) ─── */
.nav-label {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.18s ease, max-width 0.22s ease;
    display: inline-block;
}
body:not(.sidebar-pinned) .sidebar:hover .nav-label,
body.sidebar-pinned .nav-label {
    opacity: 1;
    max-width: 200px;
}

/* ── h4 section labels ─── */
.h4-label {
    display: inline;
    opacity: 0;
    transition: opacity 0.18s ease;
}
body:not(.sidebar-pinned) .sidebar:hover .h4-label,
body.sidebar-pinned .h4-label {
    opacity: 1;
}

/* Menu */
.menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 8px 16px;
}
.menu::-webkit-scrollbar { display: none; }

.menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 7px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-weight: 400;
    font-size: 13.5px;
    overflow: hidden;
    white-space: nowrap;
}

.menu a:hover {
    background: var(--accent-xlight);
    color: var(--accent);
    border-left-color: transparent;
}

.menu a.active {
    background: var(--accent-light);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
    padding-left: 10px;
}

.menu a:hover .nav-icon svg,
.menu a.active .nav-icon svg {
    stroke: var(--accent);
}

.nav-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    opacity: 0.65;
}

.menu a:hover .nav-icon,
.menu a.active .nav-icon {
    opacity: 1;
}

.menu h4 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 14px 10px 6px;
    margin-top: 6px;
    border-top: 1px solid var(--border-light);
}

.menu h4:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 4px;
}

.menu h4 .nav-icon {
    display: none;
}

/* Logout */
.logout {
    background: rgb(255, 91, 91);
    padding: 10px;
    text-align: center;
    border-radius: 5px;
    text-decoration: none;
    color: white;
}

/* ===== GLOBAL HEADER ===== */
.topheader {
    position: fixed;
    top: 0;
    left: 52px;
    right: 0;
    transition: left 0.22s ease;
    height: 56px;
    background: white;
    border-bottom: 1px solid var(--border-light);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    margin: 6px 8px;
    border-radius: 6px;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 14px;
    min-width: 260px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,110,165,0.12);
    background: white;
}

.header-search-icon {
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.header-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
    padding: 0;
    margin: 0;
    width: 100%;
    display: block;
}

.header-search-input::placeholder {
    color: var(--text-muted);
}

.header-kbd {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--border-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}

.header-right {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-wrap {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.avatar-circle.small {
    width: 30px;
    height: 30px;
    font-size: 13px;
    flex-shrink: 0;
}

.avatar-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    min-width: 200px;
    z-index: 300;
    overflow: hidden;
}

.avatar-dropdown.show {
    display: block;
}

.avatar-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.avatar-menu-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.avatar-menu-role {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.avatar-menu-divider {
    height: 1px;
    background: var(--border-light);
}

.avatar-menu-item {
    display: block;
    padding: 11px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s;
}

.avatar-menu-item:hover {
    background: var(--bg-page);
}

.avatar-logout {
    color: #ef4444;
}

/* ===== MAIN CONTENT AREA ===== */
.content {
    margin-left: 52px;
    padding: 66px 24px 30px;
    background: var(--bg-page);
    overflow-y: auto;
    min-height: 100vh;
    transition: margin-left 0.22s ease;
}
body.sidebar-pinned .topheader { left: 250px; }
body.sidebar-pinned .content   { margin-left: 250px; }

