/* ============================================
   Eb3atly - style.css
   تصميم داكن/فاتح، RTL، متجاوب 320px → Desktop
   ============================================ */

:root {
  --accent: #6c5ce7;
  --accent-2: #8e7cf3;
  --bg: #0f1115;
  --bg-2: #171a21;
  --bg-3: #1e222b;
  --card: #1a1e27;
  --border: #262b36;
  --text: #e8eaf0;
  --text-2: #9aa1b2;
  --danger: #e74c3c;
  --success: #2ecc71;
  --online: #2ecc71;
  --bubble-me: linear-gradient(135deg, #6c5ce7, #5a4bd1);
  --bubble-peer: #232833;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
  --radius: 16px;
}
[data-theme="light"] {
  --bg: #f4f6fb; --bg-2: #ffffff; --bg-3: #eef1f7;
  --card: #ffffff; --border: #e3e7f0;
  --text: #1c2030; --text-2: #68718a;
  --bubble-peer: #ffffff;
  --shadow: 0 8px 32px rgba(30,35,60,.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; overflow: hidden;
  transition: background .3s, color .3s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select, button { -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select {
  font-family: inherit; font-size: .95rem; color: var(--text);
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 12px; padding: .7rem .9rem; width: 100%;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
[dir="ltr"] { text-align: left; }

/* ============ أزرار ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.4rem; border-radius: 12px; font-weight: 600; font-size: .95rem;
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--bg-3); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-google { background: var(--bg-3); border: 1px solid var(--border); }
.btn-block { width: 100%; }
.btn-sm { padding: .45rem .9rem; font-size: .85rem; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: background .2s; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-3); }
.badge {
  position: absolute; top: 2px; inset-inline-start: 2px;
  background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.app-loader {
  position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .7rem; background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 25%, transparent), transparent),
              radial-gradient(900px 500px at 10% 110%, color-mix(in srgb, var(--accent) 15%, transparent), transparent), var(--bg);
  transition: opacity .35s ease, visibility .35s ease;
}
.app-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo {
  width: 90px; height: 90px; border-radius: 22px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 2.8rem; font-weight: 800; color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 40%, transparent);
  animation: pulseLogo 1.4s ease-in-out infinite;
}
.loader-logo span { color: #ffd166; }
.loader-text { font-size: 1.3rem; font-weight: 700; letter-spacing: .04em; color: var(--text); }
@keyframes pulseLogo { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ============ شاشة الدخول ============ */
.auth-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 25%, transparent), transparent),
              radial-gradient(900px 500px at 10% 110%, color-mix(in srgb, var(--accent) 15%, transparent), transparent), var(--bg);
  padding: 1rem; overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 430px; background: var(--card);
  border: 1px solid var(--border); border-radius: 24px;
  padding: 2.2rem 1.8rem; box-shadow: var(--shadow);
  animation: slideUp .5s ease both;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; } }
.auth-logo, .empty-logo {
  width: 64px; height: 64px; margin: 0 auto .8rem; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 2rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.auth-logo span, .empty-logo span { color: #ffd166; }
.auth-card h1 { text-align: center; font-size: 1.6rem; }
.auth-sub { text-align: center; color: var(--text-2); margin: .3rem 0 1.4rem; }
.auth-tabs { display: flex; background: var(--bg-3); border-radius: 14px; padding: 4px; margin-bottom: 1.3rem; }
.auth-tab { flex: 1; padding: .6rem; border-radius: 11px; color: var(--text-2); font-weight: 600; transition: all .2s; }
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: .9rem; }
.auth-form label { display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; color: var(--text-2); }
.auth-form input { color: var(--text); }
.auth-form small { color: var(--text-2); font-size: .75rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.divider { display: flex; align-items: center; gap: .8rem; color: var(--text-2); font-size: .8rem; margin: .4rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-error { color: var(--danger); font-size: .85rem; min-height: 1.2em; }
.avatar-picker { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.avatar-preview {
  width: 84px; height: 84px; border-radius: 50%; background: var(--bg-3);
  border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--text-2); overflow: hidden; cursor: pointer;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ============ هيكل التطبيق ============ */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 340px; min-width: 300px; background: var(--bg-2);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem; }
.me { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.avatar-btn { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex-shrink: 0; transition: transform .2s; }
.avatar-btn:hover { transform: scale(1.05); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.me-info { display: flex; flex-direction: column; min-width: 0; }
.me-info strong { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info span { color: var(--text-2); font-size: .78rem; }
.sidebar-actions { display: flex; gap: .15rem; }
.search-box { padding: 0 1rem .8rem; }
.search-results { max-height: 300px; overflow-y: auto; border-block: 1px solid var(--border); background: var(--bg-2); }

.side-tabs { display: flex; gap: .4rem; padding: 0 1rem .6rem; }
.side-tab { padding: .45rem .9rem; border-radius: 10px; color: var(--text-2); font-size: .85rem; font-weight: 600; }
.side-tab.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-2); }
[data-theme="light"] .side-tab.active { color: var(--accent); }

.chat-list { flex: 1; overflow-y: auto; padding: .3rem .5rem; }
.chat-item {
  display: flex; gap: .8rem; align-items: center; width: 100%;
  padding: .7rem .6rem; border-radius: 14px; transition: background .15s; text-align: start;
}
.chat-item:hover { background: var(--bg-3); }
.chat-item.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.avatar-wrap { position: relative; width: 48px; height: 48px; flex-shrink: 0; }
.avatar-wrap img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-wrap.big { width: 96px; height: 96px; }
.presence-dot {
  position: absolute; bottom: 1px; inset-inline-end: 1px; width: 12px; height: 12px;
  border-radius: 50%; background: #7a8194; border: 2px solid var(--bg-2);
}
.presence-dot.online { background: var(--online); }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.chat-item-top strong { font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-top time { font-size: .72rem; color: var(--text-2); flex-shrink: 0; }
.chat-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .15rem; }
.chat-item-bottom p { font-size: .82rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-bottom p.me-last::after { content: " ✓✓"; color: var(--accent-2); font-size: .7rem; }
.unread-chip { background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 10px; padding: 1px 7px; flex-shrink: 0; }
.sidebar-footer { padding: .6rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .2rem; }
.side-link { text-align: start; padding: .55rem .7rem; border-radius: 10px; color: var(--text-2); font-size: .87rem; }
.side-link:hover { background: var(--bg-3); color: var(--text); }

/* نتائج البحث عن مستخدمين */
.user-result { display: flex; gap: .7rem; align-items: center; width: 100%; padding: .6rem; border-radius: 12px; text-align: start; }
.user-result:hover { background: var(--bg-3); }
.user-result img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.user-result .ur-name { font-weight: 600; font-size: .9rem; }
.user-result .ur-username { color: var(--text-2); font-size: .76rem; }
.user-result .ur-bio { color: var(--text-2); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.online-tag { color: var(--online); font-size: .72rem; }
.offline-tag { color: var(--text-2); font-size: .72rem; }
.state-msg { padding: 1.2rem; text-align: center; color: var(--text-2); font-size: .87rem; }

/* ============ منطقة المحادثة ============ */
.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; color: var(--text-2); padding: 1rem; text-align: center; }
.empty-state h2 { color: var(--text); font-size: 1.4rem; }
.empty-logo { width: 90px; height: 90px; font-size: 2.8rem; margin-bottom: 1rem; }

.chat-window { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header {
  display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.back-btn { display: none; }
.chat-peer { display: flex; align-items: center; gap: .7rem; flex: 1; min-width: 0; text-align: start; }
.peer-info { min-width: 0; display: flex; flex-direction: column; }
.peer-info strong { font-size: .98rem; }
.peer-status { font-size: .76rem; color: var(--online); }
.peer-status.off { color: var(--text-2); }
.typing { font-size: .76rem; color: var(--accent-2); min-height: 1em; }
.chat-header-actions { display: flex; gap: .1rem; }

.chat-search-bar { display: flex; align-items: center; gap: .5rem; padding: .5rem 1rem; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.chat-search-bar input { flex: 1; }
#chatSearchCount { font-size: .78rem; color: var(--text-2); white-space: nowrap; }

.pinned-bar { padding: .5rem 1rem; background: color-mix(in srgb, var(--accent) 10%, var(--bg-2)); border-bottom: 1px solid var(--border); font-size: .82rem; }
.pinned-bar .pin-item { display: flex; gap: .5rem; align-items: center; padding: .25rem 0; }

.messages {
  flex: 1; overflow-y: auto; padding: 1rem;
  display: flex; flex-direction: column; gap: .35rem;
  background: radial-gradient(800px 400px at 50% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent);
}
.day-sep { align-self: center; background: var(--bg-3); color: var(--text-2); font-size: .72rem; padding: .25rem .9rem; border-radius: 12px; margin: .6rem 0; }
.msg { max-width: min(78%, 560px); padding: .55rem .8rem; border-radius: var(--radius); position: relative; animation: msgIn .25s ease both; word-break: break-word; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
.msg.me { align-self: flex-start; background: var(--bubble-me); color: #fff; border-bottom-left-radius: 4px; }
.msg.peer { align-self: flex-end; background: var(--bubble-peer); border-bottom-right-radius: 4px; }
.msg.selected { outline: 2px solid var(--accent); }
.msg.highlight { animation: hl 1.6s ease; }
@keyframes hl { 0%, 60% { background: color-mix(in srgb, var(--accent) 40%, transparent); } }
.msg-text { white-space: pre-wrap; line-height: 1.55; font-size: .94rem; }
.msg-text mark { background: #ffd166; color: #111; border-radius: 3px; padding: 0 2px; }
.msg img.msg-img { border-radius: 12px; max-width: 280px; max-height: 320px; object-fit: cover; cursor: zoom-in; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: .3rem; font-size: .68rem; margin-top: .25rem; opacity: .85; }
.msg.peer .msg-meta { color: var(--text-2); }
.tick { font-size: .78rem; letter-spacing: -2px; }
.tick.seen { color: #4fc3f7; }
.msg .edited-tag { font-size: .68rem; opacity: .8; }
.msg.deleted .msg-text { font-style: italic; opacity: .6; }
.reply-quote {
  border-inline-start: 3px solid currentColor; opacity: .85;
  padding: .2rem .55rem; margin-bottom: .35rem; font-size: .8rem; border-radius: 6px; background: rgba(0,0,0,.15);
}
.msg.peer .reply-quote { background: var(--bg-3); }
.reactions-row { display: flex; gap: .25rem; margin-top: .3rem; flex-wrap: wrap; }
.reaction-chip { background: rgba(0,0,0,.22); border-radius: 10px; padding: 1px 7px; font-size: .78rem; }
.msg.peer .reaction-chip { background: var(--bg-3); }
.reaction-chip.mine { outline: 1px solid var(--accent); }
.msg-select { position: absolute; top: 6px; inset-inline-end: 6px; width: 18px; height: 18px; accent-color: var(--accent); }
.load-more { align-self: center; background: var(--bg-3); color: var(--text-2); font-size: .78rem; padding: .3rem .9rem; border-radius: 10px; }

.composer-meta { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .45rem 1rem; background: var(--bg-2); border-top: 1px solid var(--border); font-size: .83rem; color: var(--text-2); }
.composer-meta .cm-cancel { color: var(--danger); font-size: 1rem; }

.composer { display: flex; align-items: flex-end; gap: .45rem; padding: .7rem 1rem; background: var(--bg-2); border-top: 1px solid var(--border); position: relative; }
.composer textarea { resize: none; max-height: 120px; flex: 1; }
.send-btn { width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 1.1rem; flex-shrink: 0; }
.emoji-picker {
  position: absolute; bottom: 64px; inset-inline-start: 12px; z-index: 50;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: .6rem; display: grid; grid-template-columns: repeat(6, 1fr); gap: .2rem;
  box-shadow: var(--shadow); animation: slideUp .2s ease both;
}
.emoji-picker button { font-size: 1.35rem; padding: .3rem; border-radius: 8px; }
.emoji-picker button:hover { background: var(--bg-3); }

.image-preview { display: flex; gap: .8rem; align-items: center; padding: .7rem 1rem; background: var(--bg-2); border-top: 1px solid var(--border); }
.image-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.preview-actions { flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.progress { height: 6px; background: var(--bg-3); border-radius: 4px; overflow: hidden; width: 100%; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ============ الألواح الجانبية ============ */
.panel {
  position: fixed; top: 0; inset-inline-end: 0; height: 100vh; width: min(400px, 100vw);
  background: var(--bg-2); border-inline-start: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100;
  animation: panelIn .28s ease both; box-shadow: var(--shadow);
}
.panel.wide { width: min(760px, 100vw); }
@keyframes panelIn { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-header { display: flex; align-items: center; gap: .6rem; padding: 1rem; border-bottom: 1px solid var(--border); }
.panel-header h3 { flex: 1; font-size: 1.05rem; }
.panel-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }

.profile-view { display: flex; flex-direction: column; gap: 1rem; align-items: center; text-align: center; }
.profile-hero .avatar-wrap { margin: 0 auto .7rem; }
.profile-hero h3 { font-size: 1.3rem; }
.pv-username { color: var(--accent-2); font-size: .9rem; }
.pv-bio { color: var(--text-2); margin-top: .5rem; font-size: .9rem; }
.pv-status { font-size: .8rem; color: var(--online); margin-top: .3rem; }
.pv-status.off { color: var(--text-2); }
.profile-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.profile-edit { display: flex; flex-direction: column; gap: .8rem; }
.profile-edit label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--text-2); }
.row-btns { display: flex; gap: .6rem; justify-content: flex-end; }

.settings-group { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; display: flex; flex-direction: column; gap: .5rem; }
.settings-group h4 { font-size: .85rem; color: var(--text-2); margin-bottom: .2rem; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .45rem 0; font-size: .9rem; }
.setting-row select { width: auto; }
.switch { display: none; }
.switch-row { cursor: pointer; }
.switch-row i { width: 42px; height: 24px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 14px; position: relative; transition: background .2s; flex-shrink: 0; }
.switch-row i::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: all .2s; }
.switch:checked + i { background: var(--accent); border-color: var(--accent); }
.switch:checked + i::after { transform: translateX(-18px); background: #fff; }

.notif-item { display: flex; gap: .7rem; padding: .7rem; border-radius: 14px; background: var(--card); border: 1px solid var(--border); align-items: flex-start; }
.notif-item.unread { border-inline-start: 3px solid var(--accent); }
.notif-item .n-icon { font-size: 1.3rem; }
.notif-item .n-body { flex: 1; min-width: 0; }
.notif-item .n-title { font-weight: 600; font-size: .9rem; }
.notif-item .n-text { color: var(--text-2); font-size: .82rem; }
.notif-item time { font-size: .72rem; color: var(--text-2); }

/* الأدمن */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; display: flex; flex-direction: column; gap: .2rem; }
.stat-card .s-num { font-size: 1.5rem; font-weight: 800; color: var(--accent-2); }
.stat-card .s-label { font-size: .78rem; color: var(--text-2); }
.skeleton { min-height: 74px; background: linear-gradient(100deg, var(--card) 40%, var(--bg-3) 50%, var(--card) 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.admin-tabs { display: flex; gap: .4rem; }
.admin-list { display: flex; flex-direction: column; gap: .5rem; }
.admin-user { display: flex; gap: .7rem; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: .6rem .8rem; flex-wrap: wrap; }
.admin-user img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.admin-user .au-info { flex: 1; min-width: 120px; }
.admin-user .au-info strong { font-size: .9rem; display: block; }
.admin-user .au-info span { font-size: .75rem; color: var(--text-2); }
.tag { font-size: .68rem; padding: 2px 8px; border-radius: 8px; font-weight: 700; }
.tag.pending { background: #f39c1230; color: #f39c12; }
.tag.reviewing { background: #3498db30; color: #3498db; }
.tag.resolved { background: #2ecc7130; color: #2ecc71; }
.tag.rejected { background: #e74c3c30; color: #e74c3c; }

/* ============ حوارات وقوائم ============ */
.dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.dialog { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 1.4rem; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: .9rem; animation: slideUp .25s ease both; }
.dialog h3 { font-size: 1.1rem; }
.dialog p { color: var(--text-2); font-size: .9rem; }
.dialog select, .dialog textarea { width: 100%; }
.ctx-menu { position: fixed; z-index: 300; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: .35rem; min-width: 190px; box-shadow: var(--shadow); animation: slideUp .15s ease both; }
.ctx-menu button { display: flex; gap: .6rem; width: 100%; text-align: start; padding: .55rem .8rem; border-radius: 10px; font-size: .88rem; }
.ctx-menu button:hover { background: var(--bg-3); }
.ctx-menu button.danger { color: var(--danger); }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 400; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 16px; inset-inline-start: 16px; color: #fff; font-size: 1.3rem; }
#lightboxDownload { position: absolute; bottom: 20px; }

.toast-container { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(50%); z-index: 500; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: .7rem 1.2rem; font-size: .88rem; box-shadow: var(--shadow); animation: slideUp .25s ease both; max-width: 90vw; }
.toast.success { border-inline-start: 3px solid var(--success); }
.toast.error { border-inline-start: 3px solid var(--danger); }
.toast.info { border-inline-start: 3px solid var(--accent); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .sidebar { width: 320px; min-width: 260px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; inset: 0; z-index: 90; width: 100%; max-width: none; transform: translateX(0); transition: transform .25s ease; }
  .app.chat-open .sidebar { transform: translateX(105%); }
  .back-btn { display: inline-flex; }
  .msg { max-width: 88%; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chat-header-actions .icon-btn { width: 36px; height: 36px; }
}
@media (max-width: 360px) {
  html { font-size: 15px; }
  .auth-card { padding: 1.6rem 1.1rem; }
}

/* Accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }
