.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    justify-content: center;
    align-items: flex-end;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.overlay.active {
    display: flex;
}

.modal, .panel {
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpProfile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--glass-border);
    border-bottom: none;
}

.panel-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.panel-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.panel-menu {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 2px;
}

.panel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
}

.panel-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.panel-item:active {
    background: var(--bg-hover);
}

.panel-item.danger {
    color: var(--danger);
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.contact-item:active {
    background: var(--bg-hover);
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.contact-name {
    font-weight: 500;
    font-size: 15px;
}

#imageOverlay {
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#imageOverlay .icon-btn {
    position: absolute;
    top: calc(20px + var(--safe-top));
    right: 20px;
    background: rgba(0,0,0,0.6);
    color: white;
}

.edit-label {
    color: #f59e0b !important;
}

.wallpaper-picker h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 8px 0;
}

.wallpaper-option {
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all 0.2s ease;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px;
}

.wallpaper-option:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.wallpaper-option.default {
    background: var(--surface);
}

.modal-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}
.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.modal-close { flex-shrink: 0; }

.header-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 4px;
    z-index: 300;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 6px;
    min-width: 240px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--glass-border);
    animation: menuScaleIn 0.15s cubic-bezier(0.16,1,0.3,1);
    transform-origin: top right;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.15s;
}

.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item:active { background: var(--bg-tertiary); }
.dropdown-item svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 8px; }

.new-chat-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.new-chat-action:hover {
    background: var(--accent);
    color: white;
}

.new-chat-action svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

.new-chat-action:hover svg {
    color: white;
}

.new-chat-action span {
    font-size: 14px;
    font-weight: 500;
}

.new-chat-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px 8px;
}
