header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 20px;
    height: 60px;
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

header .item { height: 60px; margin-right: auto; display: flex; align-items: center; }

header .item.active { border-bottom: 3px solid #007bff; }

header .item box-icon {
    width: 24px;
    height: 24px;
}

header .item a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; text-decoration: none; color: #1f2937; }

header .item a span { 
    font-size: 14px; 
    font-weight: bold;
    color: #007bff;
}

header .menu { height: 100%; min-width: 150px; position: relative; display: flex; align-items: center; justify-content: end; }

header nav { position: absolute; min-width: 180px; border: 1px solid #e5e7eb; padding: 10px; background-color: white; border-radius: 10px; z-index: 1000; right: 0; top: 60px; display: none; box-shadow: 0 10px 30px rgba(0,0,0,.08); }

header .user-icon { position: static; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid #e5e7eb; cursor: pointer; display: block; }

header .menu:hover > nav,
header nav:hover {
    display: block;
}

/* Also show on explicit open (for touch/click) */
header .menu.open > nav { display: block; }

header nav ul {
    list-style: none;
    padding: 5px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

header nav ul li {
    height: 30px;
    text-align: start;
    padding: 5px 10px;
}

header nav ul li a {
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

header nav ul li a span {
    font-size: 12px;
    width: 100%;
}

header nav ul li:hover { background: #f3f4f6; border-radius: 8px; }

/* Logo image should not be cropped */
header .logo { flex: 0 0 auto; display: flex; align-items: center; }
header .logo img { width: auto; height: 28px; object-fit: contain; display: block; }

/* Mobile-first adjustments */
@media (max-width: 640px) {
    header { padding: 0 12px; }
    header .logo img { height: 22px; }
    header .item a { flex-direction: column; gap: 2px; }
    header .item a span { font-size: 12px; }
    header .menu { min-width: 56px; }
    header .user-icon { width: 32px; height: 32px; }
    header nav { top: 56px; }
}