:root {
    --bg: #0a0a0a; --card: #111a14; --card-light: #1a2b20;
    --green: #2ed573; --green-dark: #16a34a;
    --red: #ff4757; --orange: #ffa502;
    --text: #fff; --text-dim: #888;
    --border: rgba(46,213,115,0.2);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100dvh; width: 100%; overflow: hidden; font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }

/* ─── Login ─ */
.login-page { display: flex; align-items: center; justify-content: center; height: 100%; padding: 20px; }
.login-box { background: var(--card); padding: 30px 24px; border-radius: 20px; width: 100%; max-width: 340px; text-align: center; border: 1px solid var(--border); }
.login-box h1 { font-size: 28px; color: var(--green); margin-bottom: 8px; }
.login-box p { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.login-box input { width: 100%; padding: 14px; background: var(--card-light); border: 1px solid var(--border); border-radius: 12px; color: #fff; font-size: 18px; text-align: center; margin-bottom: 12px; }
.login-box input:focus { outline: none; border-color: var(--green); }
.login-box .btn-go { width: 100%; padding: 14px; background: var(--green); border: none; border-radius: 12px; color: #000; font-weight: bold; font-size: 16px; cursor: pointer; }

/* ─── App Layout ─ */
.app-container { display: none; height: 100%; flex-direction: row; }
.app-container.active { display: flex; }

/* Sidebar */
.sidebar { width: 70px; background: var(--card); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 10px 0; overflow-y: auto; flex-shrink: 0; }
.sidebar-list { flex: 1; width: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding-bottom: 10px; }
.sidebar-item { width: 48px; height: 48px; border-radius: 50%; background: var(--card-light); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; margin-bottom: 12px; cursor: pointer; transition: all 0.2s; color: var(--text-dim); border: 2px solid transparent; flex-shrink: 0; user-select: none; position: relative; }
.sidebar-item.online { border-color: var(--green); }
.sidebar-item.online::after { content: ''; position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; background: var(--green); border-radius: 50%; }
.sidebar-item:hover { border-color: var(--green); color: var(--green); }
.sidebar-item.active { background: var(--green); color: #000; border-color: var(--green); }
.invite-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--green); color: #000; display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer; margin-top: auto; flex-shrink: 0; border: none; }
.invite-btn:active { transform: scale(0.9); }

/* Chat Area */
.chat-area { flex: 1; display: flex; flex-direction: column; background: var(--bg); min-width: 0; }
.chat-header { padding: 10px 12px; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.chat-info h3 { font-size: 15px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.chat-info span { font-size: 10px; color: var(--green); }
.chat-actions { display: flex; gap: 10px; margin-left: 10px; }
.action-btn { background: none; border: none; font-size: 20px; cursor: pointer; opacity: 0.5; transition: 0.2s; }
.action-btn.active { opacity: 1; }
.action-btn:active { transform: scale(0.9); }

/* Messages */
.messages { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.msg { padding: 10px 14px; border-radius: 16px; max-width: 80%; font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.msg.mine { background: var(--green-dark); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.theirs { background: var(--card); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg .time { font-size: 9px; opacity: 0.6; margin-top: 4px; text-align: right; display: block; }
.msg.system { background: transparent; color: var(--text-dim); align-self: center; font-size: 11px; font-style: italic; }

/* Input */
.chat-input { padding: 10px 12px; background: var(--card); border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.chat-input input { flex: 1; padding: 10px 14px; background: var(--card-light); border: none; border-radius: 20px; color: #fff; font-size: 14px; min-width: 0; }
.chat-input input:focus { outline: none; }
.send-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--green); border: none; color: #000; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ─── Pop-up Custom ─ */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.show { display: flex; }
.modal-box { background: var(--card); padding: 24px 20px; border-radius: 20px; width: 100%; max-width: 320px; text-align: center; border: 1px solid var(--border); }
.modal-box h4 { color: var(--green); margin-bottom: 16px; font-size: 18px; }
.modal-box input { width: 100%; padding: 12px; background: var(--card-light); border: 1px solid var(--border); border-radius: 10px; color: #fff; font-size: 18px; text-align: center; margin-bottom: 16px; }
.modal-box input:focus { outline: none; border-color: var(--green); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; padding: 12px; border: none; border-radius: 10px; font-weight: bold; cursor: pointer; }
.btn-confirm { background: var(--green); color: #000; }
.btn-cancel { background: var(--card-light); color: var(--text-dim); }

/* ─── Toast ─ */
.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: 90%; max-width: 350px; }
.toast { padding: 14px 20px; border-radius: 50px; font-size: 13px; font-weight: bold; text-align: center; animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.toast.success { background: var(--green); color: #000; }
.toast.error { background: var(--red); color: #fff; }
.toast.warning { background: var(--orange); color: #000; }
.toast.info { background: var(--card-light); color: #fff; border: 1px solid var(--green-dark); }
@keyframes slideDown { from { opacity:0; transform:translate(-50%,-20px); } to { opacity:1; transform:translate(-50%,0); } }
@keyframes fadeOut { to { opacity: 0; transform: translate(-50%,-10px); } }
