* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    color: #f0f0f0;
    transition: background 0.3s ease, color 0.3s ease;
    overflow: hidden;
}

/* ===== СВЕТЛАЯ ТЕМА (ГЛОБАЛЬНО) ===== */
body.light {
    background: #f0f0f0 !important;
    color: #0a0a0a !important;
}

body.light #app {
    background: #ffffff !important;
}

body.light #auth-container {
    background: #ffffff !important;
}

body.light .auth-page {
    background: #ffffff !important;
}

body.light .auth-page input {
    background: #f0f2f5 !important;
    color: #0a0a0a !important;
}

body.light .auth-page input::placeholder {
    color: #999999 !important;
}

body.light .auth-page .auth-error {
    color: #e74c3c !important;
}

body.light .auth-page .auth-footer {
    color: #999999 !important;
}

body.light .auth-page .auth-footer span {
    color: #f5a623 !important;
}

body.light #code-overlay .code-box {
    background: #ffffff !important;
    border-color: #e0e4e8 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
}

body.light #code-overlay .code-header .title {
    color: #0a0a0a !important;
}

body.light #code-overlay .code-header .close-btn:hover {
    color: #0a0a0a !important;
}

body.light #code-overlay .code-desc {
    color: #666666 !important;
}

body.light #code-overlay .code-input-wrapper input {
    background: #f0f2f5 !important;
    border-color: #d0d4d8 !important;
    color: #0a0a0a !important;
}

body.light #code-overlay .code-actions .secondary {
    background: #f0f2f5 !important;
    color: #0a0a0a !important;
}

body.light #reset-overlay .code-box {
    background: #ffffff !important;
    border-color: #e0e4e8 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
}

body.light #reset-overlay .code-header .title {
    color: #0a0a0a !important;
}

body.light #reset-overlay .code-header .close-btn:hover {
    color: #0a0a0a !important;
}

body.light #reset-overlay .code-desc {
    color: #666666 !important;
}

body.light #reset-overlay .code-input-wrapper input {
    background: #f0f2f5 !important;
    border-color: #d0d4d8 !important;
    color: #0a0a0a !important;
}

body.light #reset-overlay .code-actions .secondary {
    background: #f0f2f5 !important;
    color: #0a0a0a !important;
}

body.light #reset-overlay #reset-step3 input {
    background: #f0f2f5 !important;
    border-color: #d0d4d8 !important;
    color: #0a0a0a !important;
}

/* ===== MAIN LAYOUT ===== */
#app {
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease;
    overflow: hidden;
    position: relative;
}

#auth-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #0a0a0a;
    transition: opacity 0.4s ease, transform 0.4s ease, background 0.3s ease;
    z-index: 50;
    overflow: hidden;
    pointer-events: auto;
}

#auth-container.hidden {
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
    z-index: 0;
}

.auth-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 30px;
    background: #0a0a0a;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                filter 0.5s ease,
                background 0.3s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform, opacity, filter;
}

.auth-page .page-box {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-page .logo {
    font-size: 48px;
    text-align: center;
    font-weight: 700;
    color: #f5a623;
}

.auth-page h1 {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: #f5a623;
}

.auth-page input {
    background: #1a1a1a;
    border: none;
    padding: 16px 20px;
    border-radius: 14px;
    color: #f0f0f0;
    font-size: 16px;
    outline: none;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.2s;
    width: 100%;
}

.auth-page input:focus {
    box-shadow: 0 0 0 2px #f5a623;
}

.auth-page input::placeholder {
    color: #666666;
    transition: color 0.3s ease;
}

.auth-page button {
    background: #f5a623;
    color: #0a0a0a;
    border: none;
    padding: 16px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
    margin-top: 4px;
}

.auth-page button:active {
    transform: scale(0.97);
    opacity: 0.8;
}

.auth-page .auth-error {
    color: #e74c3c;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    transition: color 0.3s ease;
}

.auth-page .auth-error.success {
    color: #f5a623;
}

.auth-page .auth-footer {
    text-align: center;
    color: #aaaaaa;
    font-size: 15px;
    margin-top: 4px;
    transition: color 0.3s ease;
}

.auth-page .auth-footer span {
    color: #f5a623;
    font-weight: 600;
    cursor: pointer;
}

.auth-page.login-page {
    transform: translateX(0%) scale(1);
    opacity: 1;
    filter: blur(0px);
    z-index: 2;
    pointer-events: auto;
}

.auth-page.login-page.hidden {
    transform: translateX(-30%) scale(0.92);
    opacity: 0;
    filter: blur(6px);
    z-index: 0;
    pointer-events: none;
}

.auth-page.register-page {
    transform: translateX(30%) scale(0.92);
    opacity: 0;
    filter: blur(6px);
    z-index: 0;
    pointer-events: none;
}

.auth-page.register-page.visible {
    transform: translateX(0%) scale(1);
    opacity: 1;
    filter: blur(0px);
    z-index: 2;
    pointer-events: auto;
}

/* ===== CODE OVERLAY ===== */
#code-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#code-overlay.show {
    display: flex;
}

#code-overlay .code-box {
    background: #141414;
    border-radius: 20px;
    padding: 28px 32px 32px;
    max-width: 380px;
    width: 100%;
    border: 1px solid #2a2a2a;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#code-overlay .code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#code-overlay .code-header .title {
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#code-overlay .code-header .close-btn {
    background: none;
    border: none;
    color: #666666;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    transition: 0.2s;
    line-height: 1;
}

#code-overlay .code-header .close-btn:hover {
    color: #f0f0f0;
}

#code-overlay .code-desc {
    font-size: 13px;
    color: #aaaaaa;
    margin-bottom: 16px;
    line-height: 1.5;
    transition: color 0.3s ease;
}

#code-overlay .code-email-display {
    font-size: 14px;
    color: #f5a623;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
    word-break: break-all;
}

#code-overlay .code-input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

#code-overlay .code-input-wrapper input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 24px;
    text-align: center;
    letter-spacing: 8px;
    outline: none;
    transition: 0.2s;
    font-family: 'SF Mono', 'Consolas', monospace;
}

#code-overlay .code-input-wrapper input:focus {
    border-color: #f5a623;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.15);
}

#code-overlay .code-input-wrapper input.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

#code-overlay .code-error {
    color: #e74c3c;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

#code-overlay .code-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

#code-overlay .code-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 30px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

#code-overlay .code-actions button:active {
    transform: scale(0.96);
}

#code-overlay .code-actions .primary {
    background: #f5a623;
    color: #0a0a0a;
}

#code-overlay .code-actions .secondary {
    background: #1a1a1a;
    color: #f0f0f0;
    transition: background 0.3s ease, color 0.3s ease;
}

#code-overlay .code-actions .resend {
    background: transparent;
    color: #f5a623;
    font-weight: 400;
    font-size: 13px;
    flex: 0.5;
}

#code-overlay .code-actions .resend:hover {
    text-decoration: underline;
}

/* ===== RESET OVERLAY ===== */
#reset-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 110;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#reset-overlay.show {
    display: flex;
}

#reset-overlay .code-box {
    background: #141414;
    border-radius: 20px;
    padding: 28px 32px 32px;
    max-width: 400px;
    width: 100%;
    border: 1px solid #2a2a2a;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#reset-overlay .code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

#reset-overlay .code-header .title {
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#reset-overlay .code-header .close-btn {
    background: none;
    border: none;
    color: #666666;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    transition: 0.2s;
    line-height: 1;
}

#reset-overlay .code-header .close-btn:hover {
    color: #f0f0f0;
}

#reset-overlay .code-desc {
    font-size: 13px;
    color: #aaaaaa;
    margin-bottom: 12px;
    line-height: 1.5;
    transition: color 0.3s ease;
}

#reset-overlay .code-input-wrapper {
    position: relative;
    margin-bottom: 12px;
}

#reset-overlay .code-input-wrapper input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 16px;
    outline: none;
    transition: 0.2s;
}

#reset-overlay .code-input-wrapper input:focus {
    border-color: #f5a623;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.12);
}

#reset-overlay .code-error {
    color: #e74c3c;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

#reset-overlay .code-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

#reset-overlay .code-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 30px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

#reset-overlay .code-actions button:active {
    transform: scale(0.96);
}

#reset-overlay .code-actions .primary {
    background: #f5a623;
    color: #0a0a0a;
}

#reset-overlay .code-actions .secondary {
    background: #1a1a1a;
    color: #f0f0f0;
    transition: background 0.3s ease, color 0.3s ease;
}

#reset-overlay .code-actions .resend {
    background: transparent;
    color: #f5a623;
    font-weight: 400;
    font-size: 13px;
    flex: 0.5;
}

#reset-overlay .code-actions .resend:hover {
    text-decoration: underline;
}

#reset-overlay #reset-step3 input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 16px;
    outline: none;
    transition: 0.2s;
    margin-bottom: 8px;
}

#reset-overlay #reset-step3 input:focus {
    border-color: #f5a623;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.12);
}

/* ===== PASSWORD METER ===== */
.password-meter {
    display: none;
    width: 100%;
    height: 4px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
    position: relative;
    transition: background 0.3s ease;
}

.password-meter.show {
    display: block;
}

.password-meter .meter-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

.password-meter .meter-fill.weak {
    background: #e74c3c;
    width: 25%;
}

.password-meter .meter-fill.medium {
    background: #f5a623;
    width: 40%;
}

.password-meter .meter-fill.good {
    background: #f5a623;
    width: 70%;
}

.password-meter .meter-fill.strong {
    background: #27ae60;
    width: 100%;
}

.password-hint {
    display: none;
    font-size: 12px;
    color: #aaaaaa;
    margin-top: 4px;
    min-height: 18px;
    transition: color 0.3s ease;
}

.password-hint.show {
    display: block;
}

.password-hint.weak {
    color: #e74c3c;
}

.password-hint.medium {
    color: #f5a623;
}

.password-hint.good {
    color: #f5a623;
}

.password-hint.strong {
    color: #27ae60;
}

#register-progress {
    display: none;
    width: 100%;
    max-width: 400px;
    height: 4px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

#register-progress.show {
    display: block;
}

#register-progress .progress-fill {
    height: 100%;
    width: 0%;
    background: #f5a623;
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* ===== MAIN LAYOUT ===== */
#main-layout {
    display: none;
    flex: 1;
    height: 100%;
    width: 100%;
    flex-direction: row;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

#main-layout.active {
    display: flex;
    opacity: 1;
}

/* ===== LEFT PANEL ===== */
#left-panel {
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    border-right: 1px solid #2a2a2a;
    transition: background 0.3s ease, border-color 0.3s ease;
    min-width: 180px;
    width: 300px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

#left-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
    min-height: 56px;
    transition: border-color 0.3s ease;
}

#left-panel .panel-header .left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5a623;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #0a0a0a;
    cursor: pointer;
    transition: 0.2s;
    overflow: hidden;
    flex-shrink: 0;
    border: none;
}

#avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#avatar-btn:active {
    transform: scale(0.92);
}

#left-panel .panel-title {
    font-size: 17px;
    font-weight: 700;
    cursor: default;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#left-panel .panel-header .right {
    display: flex;
    gap: 6px;
    align-items: center;
}

#left-panel .panel-header .right .icon-btn {
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s ease, transform 0.2s;
}

#left-panel .panel-header .right .icon-btn:active {
    transform: scale(0.88);
}

/* ===== SEARCH BAR ===== */
#search-bar {
    padding: 8px 12px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

#search-bar input {
    width: 100%;
    padding: 8px 14px;
    border-radius: 20px;
    border: none;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 14px;
    outline: none;
    transition: background 0.3s ease, color 0.3s ease;
}

#search-bar input:focus {
    box-shadow: 0 0 0 2px #f5a623;
}

#search-bar input::placeholder {
    color: #666666;
    transition: color 0.3s ease;
}

/* ===== CHAT LIST ===== */
#chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px;
    padding-bottom: 70px;
}

.empty-chats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666666;
    font-size: 14px;
    text-align: center;
    gap: 6px;
    transition: color 0.3s ease;
}

.empty-chats .icon {
    font-size: 36px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-bottom: 2px;
    position: relative;
}

.chat-item:hover {
    background: #1a1a1a;
}

.chat-item.active {
    background: #1a1a1a;
}

.chat-item .chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #f0f0f0;
    flex-shrink: 0;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

.chat-item .chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-item .chat-info {
    flex: 1;
    min-width: 0;
}

.chat-item .chat-name {
    font-weight: 600;
    font-size: 14px;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

.chat-item .chat-preview {
    font-size: 12px;
    color: #aaaaaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.chat-item .chat-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    min-width: 30px;
}

.chat-item .chat-time {
    font-size: 10px;
    color: #666666;
    line-height: 1;
    transition: color 0.3s ease;
}

.chat-item .unread-badge {
    background: #f5a623;
    color: #0a0a0a;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}

.chat-item .unread-badge.big {
    border-radius: 12px;
    padding: 0 8px;
    min-width: 22px;
}

.chat-item .chat-type-badge {
    font-size: 9px;
    color: #f5a623;
    background: rgba(245, 166, 35, 0.12);
    padding: 1px 8px;
    border-radius: 8px;
    margin-left: 4px;
}

.chat-item .chat-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: 0.2s;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 4px;
    letter-spacing: 1px;
}

.chat-item .chat-menu-btn:hover {
    background: #2a2a2a;
    color: #f0f0f0;
}

.chat-item:hover .chat-menu-btn {
    display: block;
}

/* ===== RESIZE HANDLE ===== */
#resize-handle {
    width: 4px;
    background: transparent;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.15s;
    position: relative;
    z-index: 20;
}

#resize-handle:hover {
    background: #f5a623;
}

#resize-handle.active {
    background: #f5a623;
}

/* ===== RIGHT PANEL ===== */
#right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    transition: background 0.3s ease;
    min-width: 200px;
    overflow: hidden;
    position: relative;
}

#right-panel .panel-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
    min-height: 56px;
    gap: 10px;
    position: relative;
    z-index: 5;
    background: inherit;
    transition: border-color 0.3s ease;
}

#right-panel .panel-header .back-btn {
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.3s ease;
    display: none;
}

#right-panel .panel-header .back-btn.visible {
    display: block;
}

#right-panel .panel-header .back-btn:hover {
    color: #f5a623;
}

#right-panel .panel-header .chat-title {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    cursor: pointer;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#right-panel .panel-header .chat-title:hover {
    color: #f5a623;
}

#right-panel .panel-header .chat-type-label {
    font-size: 11px;
    color: #aaaaaa;
    background: #1a1a1a;
    padding: 2px 10px;
    border-radius: 10px;
    transition: color 0.3s ease, background 0.3s ease;
}

#right-panel .panel-header .right-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ===== QUICK PANEL ===== */
#quick-panel {
    display: none;
    position: fixed;
    background: #141414;
    border-radius: 12px;
    padding: 8px 0;
    min-width: 210px;
    max-width: 280px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    border: 1px solid #2a2a2a;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#quick-panel.show {
    display: block;
}

#quick-panel .qp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.3s ease;
    color: #f0f0f0;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

#quick-panel .qp-item:hover {
    background: #2a2a2a;
}

#quick-panel .qp-item.danger {
    color: #e74c3c;
}

#mute-submenu {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    background: #141414;
    border-radius: 12px;
    padding: 8px 0;
    min-width: 150px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    border: 1px solid #2a2a2a;
    margin-left: 4px;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#mute-submenu.show {
    display: block;
}

#mute-submenu .qp-item {
    padding: 6px 16px;
    font-size: 13px;
}

/* ===== UNDO TIMER ===== */
#undo-timer {
    display: none;
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #141414;
    border-radius: 16px;
    padding: 14px 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    z-index: 50;
    border: 1px solid #2a2a2a;
    text-align: center;
    min-width: 180px;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#undo-timer.show {
    display: flex;
}

#undo-timer .undo-svg-container {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

#undo-timer .undo-svg-container svg {
    width: 48px;
    height: 48px;
    transform: rotate(0deg);
}

#undo-timer .undo-svg-container .undo-circle-bg {
    fill: none;
    stroke: #2a2a2a;
    stroke-width: 2.5;
    stroke-dasharray: 4 6;
    stroke-linecap: round;
    transition: stroke 0.3s ease;
}

#undo-timer .undo-svg-container .undo-circle-progress {
    fill: none;
    stroke: #f5a623;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 4px rgba(245, 166, 35, 0.4));
}

#undo-timer .undo-svg-container .undo-circle-progress.danger {
    stroke: #e74c3c;
    filter: drop-shadow(0 0 4px rgba(231, 76, 60, 0.4));
}

#undo-timer .undo-svg-container .undo-spark {
    transition: opacity 0.1s ease;
}

#undo-timer .undo-svg-container .undo-spark.active {
    animation: sparkle 0.4s ease-in-out infinite alternate;
}

@keyframes sparkle {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.6);
    }
}

#undo-timer .undo-svg-container .spark1 {
    fill: #f5a623;
}

#undo-timer .undo-svg-container .spark2 {
    fill: #f5a623;
}

#undo-timer .undo-svg-container .spark3 {
    fill: #f5a623;
}

#undo-timer .undo-svg-container .spark-extra1 {
    fill: #f5a623;
}

#undo-timer .undo-svg-container .spark-extra2 {
    fill: #f5a623;
}

#undo-timer .undo-svg-container .undo-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 700;
    color: #f0f0f0;
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

#undo-timer .undo-text {
    font-size: 14px;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#undo-timer .undo-btn {
    background: #f5a623;
    color: #0a0a0a;
    border: none;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

#undo-timer .undo-btn:hover {
    opacity: 0.8;
}

/* ===== CHANNEL BG ===== */
#channel-bg-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

#channel-bg-container .bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: opacity 0.5s ease;
}

#channel-bg-container .bg-placeholder {
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    transition: background 0.3s ease;
}

#right-panel .panel-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: background 0.3s ease;
}

#right-panel-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666666;
    font-size: 15px;
    gap: 10px;
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

#right-panel-empty .big-icon {
    font-size: 56px;
    opacity: 0.3;
}

#right-panel-empty .sub-text {
    font-size: 13px;
    opacity: 0.6;
}

#right-panel-empty.hidden {
    display: none;
}

/* ===== MESSAGES ===== */
#messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: relative;
    z-index: 2;
}

#messages-container .empty-msg {
    text-align: center;
    color: #666666;
    padding: 30px 0;
    font-size: 13px;
    transition: color 0.3s ease;
}

.msg {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(26, 26, 26, 0.85);
    align-self: flex-start;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    transition: background 0.3s ease, color 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    position: relative;
    color: #f0f0f0;
}

.msg.channel-msg {
    align-self: flex-start !important;
    background: rgba(26, 26, 26, 0.85) !important;
    color: #f0f0f0 !important;
}

.msg.mine {
    align-self: flex-end;
    background: rgba(245, 166, 35, 0.9);
    color: #0a0a0a;
}

.msg .msg-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 3px;
}

.msg .msg-time {
    font-size: 9px;
    color: #666666;
    transition: color 0.3s ease;
}

.msg.mine .msg-time {
    color: rgba(10, 10, 10, 0.6);
}

.msg .msg-status {
    font-size: 10px;
    color: #666666;
    transition: color 0.3s ease;
}

.msg.mine .msg-status {
    color: rgba(10, 10, 10, 0.6);
}

.msg .msg-reaction {
    position: absolute;
    bottom: -8px;
    right: -6px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid #0a0a0a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.light .msg .msg-reaction {
    border-color: #ffffff !important;
}

.msg .msg-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-top: 3px;
}

.msg.mine .msg-file {
    background: rgba(255, 255, 255, 0.1);
}

.msg .msg-file .file-icon {
    font-size: 18px;
}

.msg .msg-file .file-name {
    font-size: 12px;
    word-break: break-all;
}

.msg .msg-file .file-size {
    font-size: 10px;
    color: #aaaaaa;
    transition: color 0.3s ease;
}

.msg.mine .msg-file .file-size {
    color: rgba(10, 10, 10, 0.6);
}

.msg .msg-image {
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    margin-top: 3px;
    cursor: pointer;
}

.msg .msg-voice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
    padding: 4px 0;
}

.msg .msg-voice .voice-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #f0f0f0;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg .msg-voice .voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.msg.mine .msg-voice .voice-play-btn {
    background: rgba(10, 10, 10, 0.2);
    color: #0a0a0a;
}

.msg.mine .msg-voice .voice-play-btn:hover {
    background: rgba(10, 10, 10, 0.3);
}

.msg .msg-voice .voice-wave {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.msg .msg-voice .voice-wave .wave-bar {
    width: 3px;
    background: #aaaaaa;
    border-radius: 2px;
    transition: height 0.2s;
}

.msg.mine .msg-voice .voice-wave .wave-bar {
    background: rgba(10, 10, 10, 0.6);
}

.msg .msg-voice .voice-duration {
    font-size: 11px;
    color: #aaaaaa;
    min-width: 30px;
    text-align: right;
    transition: color 0.3s ease;
}

.msg.mine .msg-voice .voice-duration {
    color: rgba(10, 10, 10, 0.6);
}

/* ===== MESSAGE INPUT ===== */
#message-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 12px;
    border-top: 1px solid rgba(42, 42, 42, 0.5);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background: rgba(10, 10, 10, 0.5);
    transition: background 0.3s ease, border-color 0.3s ease;
}

#message-input-area input[type="text"] {
    flex: 1;
    padding: 8px 14px;
    border-radius: 30px;
    border: none;
    background: rgba(26, 26, 26, 0.7);
    color: #f0f0f0;
    font-size: 14px;
    outline: none;
    transition: background 0.3s ease, color 0.3s ease;
}

#message-input-area input[type="text"]:focus {
    box-shadow: 0 0 0 2px #f5a623;
}

#message-input-area .input-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(26, 26, 26, 0.7);
    color: #aaaaaa;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#message-input-area .input-btn:active {
    transform: scale(0.9);
}

#message-input-area .input-btn.send-btn {
    background: #f5a623;
    color: #0a0a0a;
}

#message-input-area .input-btn.send-btn:active {
    opacity: 0.8;
}

#message-input-area .input-btn.voice-btn {
    background: #e74c3c;
    color: white;
    font-size: 14px;
    transition: 0.2s;
    position: relative;
}

#message-input-area .input-btn.voice-btn:active {
    transform: scale(0.9);
}

#message-input-area .input-btn.voice-btn.recording {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== RECORDING TIMER ===== */
#recording-timer {
    display: none;
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 30px;
    padding: 8px 20px;
    font-size: 14px;
    color: #f0f0f0;
    z-index: 60;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#recording-timer.show {
    display: flex;
}

#recording-timer .rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e74c3c;
    animation: blink 0.8s ease-in-out infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.2;
    }
    100% {
        opacity: 1;
    }
}

#recording-timer .rec-time {
    font-weight: 600;
    min-width: 40px;
}

#recording-timer .rec-hint {
    font-size: 12px;
    color: #aaaaaa;
}

/* ===== FAB BUTTON ===== */
#fab-btn {
    position: absolute;
    bottom: 18px;
    right: 18px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f5a623;
    color: #0a0a0a;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(245, 166, 35, 0.4);
    transition: 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: 300;
}

#fab-btn:active {
    transform: scale(0.9);
}

#fab-btn.hidden {
    display: none;
}

/* ===== CREATE MODAL ===== */
#create-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 300;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#create-modal.show {
    display: flex;
}

#create-modal .modal-content {
    background: #141414;
    border-radius: 18px;
    padding: 24px 22px 22px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: modalIn 0.2s ease;
    border: 1px solid #2a2a2a;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#create-modal .modal-title {
    font-size: 19px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#create-modal .create-type-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

#create-modal .create-type-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: 2px solid #2a2a2a;
    background: transparent;
    color: #aaaaaa;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    min-width: 60px;
}

#create-modal .create-type-btn.active {
    border-color: #f5a623;
    color: #f5a623;
    background: rgba(245, 166, 35, 0.08);
}

#create-modal .create-type-btn:active {
    transform: scale(0.96);
}

.create-avatar-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.create-avatar-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s ease;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    border: 2px solid #2a2a2a;
}

.create-avatar-wrapper:hover {
    border-color: #f5a623;
    box-shadow: 0 0 24px rgba(245, 166, 35, 0.25);
    transform: scale(1.02);
}

.create-avatar-wrapper .avatar-svg {
    width: 64px;
    height: 64px;
    display: block;
    transition: filter 0.3s ease;
}

.create-avatar-wrapper:hover .avatar-svg {
    filter: drop-shadow(0 0 14px rgba(245, 166, 35, 0.35));
}

.create-avatar-wrapper .avatar-svg .camera-icon {
    opacity: 0.7;
    transition: opacity 0.3s ease;
    transform-origin: center;
}

.create-avatar-wrapper:hover .avatar-svg .camera-icon {
    opacity: 1;
}

.create-avatar-wrapper .avatar-svg .dashed-ring {
    transition: stroke 0.3s ease, stroke-width 0.3s ease, filter 0.3s ease;
}

.create-avatar-wrapper:hover .avatar-svg .dashed-ring {
    stroke: #f5a623;
    stroke-width: 3;
    filter: drop-shadow(0 0 10px rgba(245, 166, 35, 0.5));
}

.create-avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.create-fields {
    flex: 1;
}

.create-fields input,
.create-fields textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 14px;
    outline: none;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    font-family: inherit;
    margin-bottom: 8px;
}

.create-fields input:focus,
.create-fields textarea:focus {
    border-color: #f5a623;
}

.create-fields textarea {
    resize: none;
    min-height: 50px;
    height: 50px;
    max-height: 50px;
    overflow-y: auto;
}

.create-fields input::placeholder,
.create-fields textarea::placeholder {
    color: #666666;
    transition: color 0.3s ease;
}

.create-buttons {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.create-buttons button {
    flex: 1;
    padding: 10px;
    border-radius: 30px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.create-buttons button:active {
    transform: scale(0.96);
}

.create-buttons button.primary {
    background: #f5a623;
    color: #0a0a0a;
}

.create-buttons button.secondary {
    background: #1a1a1a;
    color: #f0f0f0;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ===== PROFILE OVERLAY ===== */
#profile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 250;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#profile-overlay.show {
    display: flex;
}

#profile-overlay .profile-box {
    background: #141414;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    animation: profileIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    border: 1px solid #2a2a2a;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

@keyframes profileIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#profile-overlay .profile-header {
    position: relative;
    height: 120px;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 24px 24px 0 0;
    transition: background 0.3s ease;
}

#profile-overlay .profile-header .cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-overlay .profile-header .cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #666666;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    transition: background 0.3s ease, color 0.3s ease;
}

#profile-overlay .profile-avatar-container {
    position: absolute;
    bottom: -30px;
    left: 24px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid #141414;
    overflow: hidden;
    background: #141414;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease, background 0.3s ease;
}

#profile-overlay .profile-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-overlay .profile-avatar-container .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #0a0a0a;
    background: #f5a623;
}

#profile-overlay .profile-body {
    padding: 42px 24px 20px;
}

#profile-overlay .profile-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#profile-overlay .profile-username {
    font-size: 14px;
    color: #aaaaaa;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

#profile-overlay .profile-phone {
    font-size: 14px;
    color: #aaaaaa;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

#profile-overlay .profile-phone .phone-toggle {
    background: none;
    border: none;
    color: #f5a623;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(245, 166, 35, 0.1);
}

#profile-overlay .profile-phone .phone-toggle:hover {
    background: rgba(245, 166, 35, 0.2);
}

#profile-overlay .profile-bio {
    font-size: 14px;
    color: #aaaaaa;
    padding: 10px 0;
    border-top: 1px solid #2a2a2a;
    margin-top: 4px;
    line-height: 1.5;
    transition: color 0.3s ease, border-color 0.3s ease;
}

#profile-overlay .profile-bio.empty {
    color: #666666;
    font-style: italic;
}

#profile-overlay .profile-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

#profile-overlay .profile-actions button {
    background: #1a1a1a;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: #f0f0f0;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s;
    flex: 1;
    min-width: 60px;
}

#profile-overlay .profile-actions button:active {
    transform: scale(0.95);
    opacity: 0.7;
}

#profile-overlay .profile-actions button.primary {
    background: #f5a623;
    color: #0a0a0a;
}

#profile-overlay .profile-actions button.danger {
    background: #e74c3c;
    color: white;
}

#profile-overlay .profile-close {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    border-top: 1px solid #2a2a2a;
    padding-top: 12px;
    transition: 0.2s;
}

#profile-overlay .profile-close:hover {
    color: #f0f0f0;
}

/* ===== EDIT PROFILE ===== */
#edit-profile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 400;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#edit-profile-overlay.show {
    display: flex;
}

#edit-profile-overlay .edit-box {
    background: #141414;
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    animation: profileIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid #2a2a2a;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#edit-profile-overlay .edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

#edit-profile-overlay .edit-header .edit-title {
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#edit-profile-overlay .edit-header .edit-close {
    background: none;
    border: none;
    color: #666666;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    transition: 0.2s;
}

#edit-profile-overlay .edit-header .edit-close:hover {
    color: #f0f0f0;
}

#edit-profile-overlay .edit-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
}

#edit-profile-overlay .edit-body .edit-field {
    margin-bottom: 14px;
}

#edit-profile-overlay .edit-body .edit-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #aaaaaa;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

#edit-profile-overlay .edit-body .edit-field input,
#edit-profile-overlay .edit-body .edit-field textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 15px;
    outline: none;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    font-family: inherit;
}

#edit-profile-overlay .edit-body .edit-field input:focus,
#edit-profile-overlay .edit-body .edit-field textarea:focus {
    border-color: #f5a623;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.15);
}

#edit-profile-overlay .edit-body .edit-field textarea {
    resize: none;
    min-height: 60px;
    max-height: 100px;
}

#edit-profile-overlay .edit-body .edit-field .file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#edit-profile-overlay .edit-body .edit-field .file-input-wrapper input[type="file"] {
    display: none;
}

#edit-profile-overlay .edit-body .edit-field .file-input-wrapper .file-label {
    padding: 8px 16px;
    border-radius: 30px;
    background: #1a1a1a;
    color: #f0f0f0;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    border: 1px solid transparent;
}

#edit-profile-overlay .edit-body .edit-field .file-input-wrapper .file-label:hover {
    border-color: #f5a623;
}

#edit-profile-overlay .edit-body .edit-field .file-input-wrapper .file-preview {
    font-size: 13px;
    color: #666666;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

#edit-profile-overlay .edit-actions {
    display: flex;
    gap: 10px;
    padding: 12px 20px 20px;
    border-top: 1px solid #2a2a2a;
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

#edit-profile-overlay .edit-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 30px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

#edit-profile-overlay .edit-actions button:active {
    transform: scale(0.96);
}

#edit-profile-overlay .edit-actions button.primary {
    background: #f5a623;
    color: #0a0a0a;
}

#edit-profile-overlay .edit-actions button.secondary {
    background: #1a1a1a;
    color: #f0f0f0;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ===== CHAT PROFILE ===== */
#chat-profile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 260;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#chat-profile-overlay.show {
    display: flex;
}

#chat-profile-overlay .profile-box {
    background: #141414;
    border-radius: 20px;
    width: 100%;
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: modalIn 0.2s ease;
    border: 1px solid #2a2a2a;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#chat-profile-overlay .profile-header {
    position: relative;
    height: 100px;
    flex-shrink: 0;
    overflow: hidden;
    background: #1a1a1a;
    border-radius: 20px 20px 0 0;
    transition: background 0.3s ease;
}

#chat-profile-overlay .profile-header .cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#chat-profile-overlay .profile-header .cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #666666;
    background: #1a1a1a;
    transition: background 0.3s ease, color 0.3s ease;
}

#chat-profile-overlay .profile-avatar-container {
    position: absolute;
    bottom: -24px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid #141414;
    overflow: hidden;
    background: #141414;
    transition: border-color 0.3s ease, background 0.3s ease;
}

#chat-profile-overlay .profile-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#chat-profile-overlay .profile-avatar-container .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #0a0a0a;
    background: #f5a623;
}

#chat-profile-overlay .profile-body {
    padding: 32px 20px 16px;
}

#chat-profile-overlay .profile-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
    color: #f0f0f0;
    transition: color 0.3s ease;
}

#chat-profile-overlay .profile-username {
    font-size: 13px;
    color: #aaaaaa;
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

#chat-profile-overlay .profile-bio {
    font-size: 13px;
    color: #aaaaaa;
    padding: 8px 0;
    border-top: 1px solid #2a2a2a;
    margin-top: 4px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

#chat-profile-overlay .profile-bio.empty {
    color: #666666;
    font-style: italic;
}

#chat-profile-overlay .profile-close {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    border-top: 1px solid #2a2a2a;
    padding-top: 10px;
    transition: 0.2s;
}

/* ===== ARCHIVE ===== */
#archive-section {
    display: none;
    border-top: 1px solid #2a2a2a;
    margin-top: 4px;
    padding-top: 4px;
    transition: border-color 0.3s ease;
}

#archive-section .archive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 13px;
    color: #666666;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.3s ease;
}

#archive-section .archive-header:hover {
    background: #1a1a1a;
}

#archive-section .archive-header .archive-icon {
    font-size: 16px;
}

#archive-section .archive-header .archive-count {
    background: #1a1a1a;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 11px;
    color: #aaaaaa;
    transition: background 0.3s ease, color 0.3s ease;
}

#archive-chats {
    display: none;
    padding-left: 4px;
}

#archive-chats.open {
    display: block;
}

#archive-chats .chat-item {
    opacity: 0.7;
    padding-left: 16px;
}

#archive-chats .chat-item .chat-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

#archive-chats .chat-item .chat-name {
    font-size: 13px;
    color: #666666;
    transition: color 0.3s ease;
}

#archive-chats .chat-item .chat-preview {
    font-size: 11px;
    color: #555555;
    transition: color 0.3s ease;
}

#archive-chats .chat-item .chat-time {
    font-size: 9px;
    color: #555555;
    transition: color 0.3s ease;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 4px;
    transition: background 0.3s ease;
}

/* ===== HIDDEN ===== */
#file-input-hidden {
    display: none;
}

#create-avatar-file {
    display: none;
}

/* ===== СВЕТЛАЯ ТЕМА (ДОПОЛНИТЕЛЬНЫЕ СТИЛИ) ===== */
body.light #left-panel .panel-header .right .icon-btn {
    color: #666666 !important;
}

body.light .chat-item .chat-menu-btn {
    color: #666666 !important;
}

body.light .chat-item .chat-menu-btn:hover {
    background: #e0e4e8 !important;
    color: #0a0a0a !important;
}

body.light #quick-panel .qp-item.danger {
    color: #e74c3c !important;
}

body.light .create-avatar-wrapper {
    background: #f0f2f5 !important;
    border-color: #d0d4d8 !important;
}

body.light #edit-profile-overlay .edit-body .edit-field .file-input-wrapper .file-label {
    background: #f0f2f5 !important;
    color: #0a0a0a !important;
}

body.light #edit-profile-overlay .edit-body .edit-field .file-input-wrapper .file-preview {
    color: #999999 !important;
}

body.light #edit-profile-overlay .edit-actions button.secondary {
    background: #e8ecf0 !important;
    color: #0a0a0a !important;
}

body.light #profile-overlay .profile-close:hover {
    color: #0a0a0a !important;
}

body.light #chat-profile-overlay .profile-close:hover {
    color: #0a0a0a !important;
}

body.light .password-meter {
    background: #e0e4e8 !important;
}

body.light .password-hint {
    color: #666666 !important;
}

body.light #reset-overlay #reset-step3 input {
    background: #f0f2f5 !important;
    border-color: #d0d4d8 !important;
    color: #0a0a0a !important;
}

body.light #reset-overlay #reset-step3 input::placeholder {
    color: #999999 !important;
}

body.light #register-progress {
    background: #e0e4e8 !important;
}

body.light #code-overlay .code-header .close-btn:hover {
    color: #0a0a0a !important;
}

body.light #reset-overlay .code-header .close-btn:hover {
    color: #0a0a0a !important;
}

body.light #undo-timer .undo-svg-container .undo-circle-bg {
    stroke: #d0d4d8 !important;
}

body.light #undo-timer .undo-svg-container .undo-number {
    color: #0a0a0a !important;
}

body.light .msg .msg-file .file-size {
    color: #999999 !important;
}

body.light .msg .msg-voice .voice-duration {
    color: #999999 !important;
}

body.light .msg .msg-voice .voice-wave .wave-bar {
    background: #999999 !important;
}

body.light .msg.mine .msg-voice .voice-wave .wave-bar {
    background: rgba(10, 10, 10, 0.6) !important;
}

body.light #recording-timer {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #0a0a0a !important;
}

body.light #recording-timer .rec-hint {
    color: #666666 !important;
}

body.light #messages-container .empty-msg {
    color: #999999 !important;
}

body.light #right-panel-empty {
    color: #999999 !important;
}

body.light #channel-bg-container .bg-placeholder {
    background: #ffffff !important;
}