﻿/* WhatsApp-like look & feel (own drawings, similar feel). Light + dark themes. */
:root {
  /* Same font stack as WhatsApp Web (Arabic falls back to the same system font). */
  --font: "Roboto Variable", Roboto, "Helvetica Neue", Helvetica, sans-serif;
  --green: #00a884; --green-strong: #008069; --badge: #25d366; --danger: #ea0038; --blue-tick: #53bdeb;
  --app-bg: #eae6df; --panel: #ffffff; --panel-header: #f0f2f5; --line: #e9edef; --hover: #f5f6f6; --active: #f0f2f5;
  --text: #111b21; --text-2: #667781; --icon: #54656f; --search-bg: #f0f2f5;
  --chat-bg: #efeae2; --doodle: rgba(17, 27, 33, .055);
  --bubble-in: #ffffff; --bubble-out: #d9fdd3; --bubble-text: #111b21; --meta: #667781;
  --composer-bg: #f0f2f5; --input-bg: #ffffff; --menu-bg: #ffffff; --shadow: 0 2px 5px rgba(11,20,26,.26), 0 2px 10px rgba(11,20,26,.16);
  --day-bg: #ffffff; --day-text: #54656f; --system-bg: #ffeecd; --chip-bg: #f0f2f5; --chip-active: #d9fdd3; --chip-active-text: #008069;
}
:root[data-theme="dark"] {
  --app-bg: #0e0f0f; --panel: #161717; --panel-header: #161717; --line: #2a2c2c; --hover: #242626; --active: #2e2f2f;
  --text: #fafafa; --text-2: #a5a5a5; --icon: #d6d6d6; --search-bg: #2e2f2f;
  --chat-bg: #161717; --doodle: rgba(255, 255, 255, .06);
  --bubble-in: #242626; --bubble-out: #144d37; --bubble-text: #fafafa; --meta: rgba(250,250,250,.6);
  --composer-bg: #161717; --input-bg: #242626; --menu-bg: #242626; --shadow: 0 2px 5px rgba(0,0,0,.5);
  --day-bg: #242626; --day-text: #a5a5a5; --system-bg: #242626; --chip-bg: #242626; --chip-active: #103529; --chip-active-text: #21c063;
  --green: #21c063; --badge: #21c063;
}
:root[data-theme="dark"] .ci .body { border-bottom-color: transparent; }
:root[data-theme="dark"] .chat-head, :root[data-theme="dark"] .side-head { border-bottom: 1px solid var(--line); }
:root[data-theme="dark"] .input-wrap { border-radius: 24px; }
:root:not([data-theme="dark"]) .input-wrap { border-radius: 24px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; color: var(--text); background: var(--app-bg); }
button { font: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font: inherit; color: var(--text); }
[hidden] { display: none !important; }
svg.i { width: 24px; height: 24px; fill: currentColor; display: block; }

#app { display: flex; height: 100vh; overflow: hidden; background: var(--panel); }

/* ---------- side panel ---------- */
#sidebar { width: 30%; min-width: 320px; max-width: 460px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.side-head { height: 59px; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--panel-header); }
.me { display: flex; align-items: center; gap: 12px; }
.me .avatar { width: 40px; height: 40px; font-size: 15px; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; }
.me-text small { color: var(--text-2); font-size: 12px; }
.side-actions { display: flex; gap: 6px; }
.icon { background: none; border: 0; padding: 8px; border-radius: 50%; color: var(--icon); display: inline-flex; align-items: center; justify-content: center; }
.icon:hover { background: rgba(127,127,127,.15); }
.icon.on { color: var(--green); }
.search { padding: 7px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.search-box { display: flex; align-items: center; gap: 12px; background: var(--search-bg); border-radius: 8px; padding: 0 14px; color: var(--icon); }
.search-box svg { width: 20px; height: 20px; }
.search input { flex: 1; border: 0; background: none; padding: 9px 0; outline: none; font-size: 14px; }
.filters { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; border: 0; background: var(--chip-bg); color: var(--text-2); border-radius: 18px; padding: 6px 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip.active { background: var(--chip-active); color: var(--chip-active-text); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

#chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.ci { display: flex; align-items: center; gap: 13px; padding: 0 0 0 0; padding-inline-start: 13px; cursor: pointer; position: relative; height: 72px; }
.ci:hover { background: var(--hover); }
.ci.active { background: var(--active); }
.ci .bar { position: absolute; right: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; }
.avatar { width: 49px; height: 49px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; font-size: 17px; }
.ci .body { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--line); padding-inline-end: 15px; }
.ci:last-child .body { border-bottom: 0; }
.ci .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ci .name { font-size: 16px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ci .time { font-size: 12px; color: var(--text-2); flex: none; }
.ci.unread .time { color: var(--badge); }
.ci.unread .name { font-weight: 600; }
.ci .preview { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; min-width: 0; }
.ci .preview .txt { overflow: hidden; text-overflow: ellipsis; }
.ci.unread .preview { color: var(--text); }
.ci .deal { font-size: 12.5px; color: #53bdeb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root:not([data-theme="dark"]) .ci .deal { color: #027eb5; }
.ci .meta { display: flex; gap: 5px; align-items: center; flex: none; color: var(--text-2); }
.ci .meta svg { width: 18px; height: 18px; }
.badge { background: var(--badge); color: #111b21; border-radius: 12px; font-size: 12px; font-weight: 600; padding: 0 6px; min-width: 20px; height: 20px; line-height: 20px; text-align: center; }
.badge.mark { min-width: 20px; width: 20px; padding: 0; }
.lbls { display: flex; gap: 3px; }
.ci .chev { width: 0; overflow: hidden; color: var(--text-2); background: none; border: 0; padding: 0; transition: width .12s; display: flex; }
.ci:hover .chev, .ci .chev.open { width: 22px; }

/* ---------- chat panel ---------- */
#chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--chat-bg); }
#chat::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 1; background-image: var(--doodle-img); background-size: var(--doodle-size, 720px 720px); background-repeat: repeat; }
.empty { margin: auto; color: var(--text-2); font-size: 15px; text-align: center; position: relative; z-index: 1; padding: 20px; }
.empty .big { font-size: 28px; color: var(--text); font-weight: 300; margin-bottom: 10px; }
#chat-view { display: flex; flex-direction: column; height: 100%; position: relative; z-index: 1; }
.chat-head { height: 59px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel-header); border-inline-start: 1px solid var(--line); }
.chat-head .avatar { width: 40px; height: 40px; font-size: 15px; }
.who { flex: 1; min-width: 0; line-height: 1.3; }
.who-name { font-size: 16px; color: var(--text); }
.who-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; align-items: center; gap: 4px; }
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 6px 12px; font-size: 13px; color: var(--text); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.danger { color: var(--danger); }
.dropdown { position: relative; }
.menu { position: absolute; left: 0; top: 110%; background: var(--menu-bg); border-radius: 3px; box-shadow: var(--shadow); min-width: 240px; max-height: 420px; overflow-y: auto; z-index: 30; padding: 9px 0; }
.menu h4 { margin: 8px 24px 2px; font-size: 12px; color: var(--text-2); font-weight: 500; }
.menu a, .menu button, .menu label { display: flex; align-items: center; gap: 10px; width: 100%; text-align: right; background: none; border: 0; padding: 10px 24px; color: var(--text); text-decoration: none; font-size: 14.5px; }
.menu a:hover, .menu button:hover, .menu label:hover { background: var(--hover); }
.menu .closed { text-decoration: line-through; color: var(--text-2); }
.menu .sub { font-size: 12px; color: var(--text-2); display: block; }
.ctx-menu { position: fixed; z-index: 60; }
.chat-tags { display: flex; gap: 6px; padding: 6px 16px; flex-wrap: wrap; background: var(--panel-header); border-top: 1px solid var(--line); }
.chat-tags:empty { display: none; }
.tag { font-size: 12px; color: #fff; border-radius: 12px; padding: 2px 10px; }
.tag.ad { background: #1877f2; }

#messages { flex: 1; overflow-y: auto; padding: 12px 7% 8px; display: flex; flex-direction: column; }
.day { align-self: center; background: var(--day-bg); color: var(--day-text); font-size: 12.5px; padding: 5px 12px 6px; border-radius: 7.5px; margin: 10px 0; box-shadow: 0 1px .5px rgba(11,20,26,.13); text-transform: uppercase; }
.msg { position: relative; max-width: 65%; padding: 6px 7px 8px 9px; border-radius: 7.5px; box-shadow: 0 1px .5px rgba(11,20,26,.13); white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 20px; color: var(--bubble-text); margin-bottom: 2px; }
.msg.in { align-self: flex-start; background: var(--bubble-in); }
.msg.out { align-self: flex-end; background: var(--bubble-out); }
.msg.first { margin-top: 10px; }
.msg.in.first { border-top-right-radius: 0; }
.msg.out.first { border-top-left-radius: 0; }
/* bubble tails (RTL: incoming on the right, outgoing on the left) */
.msg.first::after { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.msg.in.first::after { right: -8px; background: var(--bubble-in); clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg.out.first::after { left: -8px; background: var(--bubble-out); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg .author { font-size: 12.8px; color: #06cf9c; font-weight: 500; margin-bottom: 2px; }
:root:not([data-theme="dark"]) .msg .author { color: #1fa855; }
.msg .text { display: inline; }
.msg .foot { float: left; margin: 6px 6px -4px 0; font-size: 11px; color: var(--meta); display: inline-flex; align-items: center; gap: 3px; height: 15px; direction: ltr; }
.msg .spacer { display: inline-block; width: 70px; }
.tick { width: 16px; height: 11px; display: inline-block; fill: currentColor; }
.tick.grey { color: var(--meta); }
.tick.blue { color: var(--blue-tick); }
.msg a { color: #027eb5; }
:root[data-theme="dark"] .msg a { color: #53bdeb; }
.msg img.photo { max-width: 330px; width: 100%; border-radius: 6px; display: block; margin-bottom: 4px; }
.msg audio { width: 260px; max-width: 100%; display: block; }
/* WhatsApp-style voice note */
/* WhatsApp keeps the voice note left-to-right even in Arabic: [avatar][play][waveform →] */
/* Compact strip like WhatsApp: play + wave centred on the avatar; duration sits under the wave without adding height.
   Incoming: avatar on the left. Outgoing (mine): avatar on the right. */
.vn { display: flex; align-items: center; gap: 10px; width: 340px; max-width: 100%; padding: 1px 0 6px; direction: ltr; }
.msg.out .vn { flex-direction: row-reverse; }
.vn-avatar { position: relative; width: 50px; height: 50px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 18px; display: flex; align-items: center; justify-content: center; flex: none; overflow: visible; }
.vn-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
/* WhatsApp-like: the progress dot (and mic badge) are green until the voice note is listened to, then blue */
.vn-mic { position: absolute; bottom: -2px; left: -4px; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bubble-in); color: #21c063; }
.msg.out .vn-mic { background: var(--bubble-out); left: auto; right: -4px; }
.vn-mic svg { width: 16px; height: 16px; fill: currentColor; }
.vn-body { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vn-row { display: flex; align-items: center; gap: 8px; height: 34px; }
.vn-play { background: none; border: 0; padding: 0; width: 28px; height: 34px; color: var(--icon); flex: none; display: flex; align-items: center; justify-content: center; }
.vn-play svg { width: 26px; height: 26px; fill: currentColor; }
.vn-wave { position: relative; flex: 1; height: 34px; display: flex; align-items: center; gap: 2px; cursor: pointer; direction: ltr; }
.vn-wave i { flex: 1; min-width: 2px; max-width: 3px; height: 30%; background: rgba(134,150,160,.55); border-radius: 2px; transition: background .1s; }
:root:not([data-theme="dark"]) .vn-wave i { background: rgba(84,101,111,.35); }
.vn-wave i.on { background: #21c063; }
.vn-dot { position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #21c063; inset-inline-start: -6px; }
.vn.played .vn-mic { color: #53bdeb; }
.vn.played .vn-dot, .vn.played .vn-wave i.on { background: #53bdeb; }
.vn-time { position: absolute; top: calc(100% + 1px); left: 36px; font-size: 11px; line-height: 14px; color: var(--meta); white-space: nowrap; }
.msg:has(.vn) .spacer { display: none; }
.msg:has(.vn) .foot { float: right; margin: -17px 2px -2px 0; }
/* mine: time + ticks bottom-left, under the play button; the duration follows it */
.msg.out:has(.vn) .foot { float: left; margin: -17px 0 -2px 2px; }
.msg.out .vn-time { left: 82px; }
/* speed pill replaces the avatar while the note is playing / paused mid-way */
.vn-speed { display: none; position: relative; isolation: isolate; flex: none; width: 50px; height: 50px; align-items: center; justify-content: center; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; color: var(--text, #e9edef); }
.vn.active .vn-avatar { display: none; }
.vn.active .vn-speed { display: flex; }
.vn-speed::after { content: ''; position: absolute; inset: 12px 2px; border-radius: 14px; background: rgba(0,0,0,.28); z-index: -1; }
:root:not([data-theme="dark"]) .vn-speed::after { background: rgba(0,0,0,.12); }
.msg video { max-width: 330px; width: 100%; border-radius: 6px; display: block; }
.msg.sticker { background: none !important; box-shadow: none; padding: 0; }
.msg.sticker::after { display: none; }
.msg.sticker img { width: 160px; height: 160px; object-fit: contain; display: block; }
.msg.sticker .foot { float: none; display: flex; justify-content: flex-start; margin: 2px 0 0; background: rgba(11,20,26,.35); color: #fff; border-radius: 10px; padding: 0 6px; width: fit-content; }
.doc { display: flex; align-items: center; gap: 10px; background: rgba(127,127,127,.12); border-radius: 6px; padding: 10px; text-decoration: none; color: inherit !important; min-width: 220px; margin-bottom: 4px; }
.doc .ext { width: 32px; height: 40px; border-radius: 3px; background: #e53935; color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; text-transform: uppercase; flex: none; }
.doc .name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- composer ---------- */
#composer { background: var(--composer-bg); padding: 5px 16px; position: relative; min-height: 62px; display: flex; flex-direction: column; justify-content: center; }
#send-form { display: flex; gap: 8px; align-items: flex-end; }
.tools { display: flex; gap: 2px; align-items: center; padding-bottom: 5px; }
.tools .icon svg { width: 26px; height: 26px; }
.input-wrap { flex: 1; background: var(--input-bg); border-radius: 8px; display: flex; align-items: flex-end; min-height: 42px; margin-bottom: 5px; }
#text { flex: 1; resize: none; border: 0; background: none; padding: 11px 12px 9px; max-height: 140px; outline: none; font-size: 15px; line-height: 20px; }
#text::placeholder { color: var(--text-2); }
.send-btn { background: none; border: 0; width: 42px; height: 42px; margin-bottom: 5px; border-radius: 50%; color: var(--icon); display: flex; align-items: center; justify-content: center; }
.send-btn svg { width: 26px; height: 26px; }
.send-btn.send svg { transform: scaleX(-1); }
.send-btn.recording { background: var(--danger); color: #fff; }
/* recording bar (WhatsApp style, grouped on the left): [send][pause][live wave][timer][●][trash] */
.rec-bar { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 0 6px; color: var(--text); font-size: 15px; height: 52px; margin-bottom: 0; background: var(--input-bg); border-radius: 26px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #f15c6d; animation: blink 1.2s infinite; flex: none; }
.rec-bar.paused .rec-dot { animation: none; opacity: .5; }
.rec-time { min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text); direction: ltr; }
.rec-wave { width: 170px; height: 26px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; direction: ltr; }
.rec-wave i { width: 2px; flex: none; background: var(--text-2); border-radius: 2px; min-height: 2px; }
.rec-icon { background: none; border: 0; padding: 4px; color: var(--icon); display: flex; align-items: center; justify-content: center; }
.rec-icon svg { width: 24px; height: 24px; fill: currentColor; }
.rec-pause { color: #f15c6d; }
.rec-send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #21c063; color: #111b21; display: flex; align-items: center; justify-content: center; flex: none; }
.rec-send svg { width: 24px; height: 24px; fill: currentColor; transform: scaleX(-1); }
@keyframes blink { 50% { opacity: .2; } }
.note { font-size: 13px; color: #8a6d00; background: #fff8e1; border-radius: 8px; padding: 8px 12px; margin: 4px 0; }
:root[data-theme="dark"] .note { background: #3a3218; color: #f3d77b; }
.picker { position: absolute; bottom: 100%; right: 0; left: 0; height: 320px; background: var(--panel-header); border-top: 1px solid var(--line); z-index: 15; display: flex; flex-direction: column; }
.picker-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.picker-tabs button { flex: 1; background: none; border: 0; padding: 10px; color: var(--text-2); border-bottom: 3px solid transparent; }
.picker-tabs button.active { color: var(--green); border-bottom-color: var(--green); }
.picker-body { flex: 1; overflow-y: auto; padding: 8px 16px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 2px; }
.emoji-grid button { background: none; border: 0; font-size: 28px; padding: 4px; border-radius: 6px; line-height: 1.2; }
.emoji-grid button:hover { background: rgba(127,127,127,.15); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.sticker-grid button { background: none; border: 0; padding: 4px; border-radius: 8px; }
.sticker-grid button:hover { background: rgba(127,127,127,.15); }
.sticker-grid img { width: 88px; height: 88px; object-fit: contain; }
.pick-item { display: block; width: 100%; text-align: right; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; color: var(--text); }
.pick-item:hover { background: var(--hover); }
.pick-item b { display: block; font-size: 14px; font-weight: 500; }
.pick-item span { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-menu { position: absolute; bottom: 64px; right: 16px; background: var(--menu-bg); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; z-index: 20; min-width: 210px; }
.attach-menu button { display: flex; align-items: center; gap: 14px; width: 100%; background: none; border: 0; padding: 10px 12px; border-radius: 10px; color: var(--text); font-size: 15px; text-align: right; }
.attach-menu button:hover { background: var(--hover); }
.attach-menu .ai { width: 22px; height: 22px; }
.ai.doc-c { color: #7f66ff; } .ai.img-c { color: #007bfc; } .ai.stk-c { color: #00a884; } .ai.qr-c { color: #ff8b00; } .ai.tpl-c { color: #ff2e74; }

/* ---------- admin ---------- */
#admin { position: fixed; inset: 0; background: var(--app-bg); overflow-y: auto; z-index: 40; }
.admin-head { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--panel-header); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }
.admin-head h2 { margin: 0; font-size: 18px; font-weight: 500; }
#admin-tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#admin-tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 18px; color: var(--text-2); }
#admin-tabs button.active { background: var(--chip-active); color: var(--chip-active-text); }
#admin-body { padding: 20px; max-width: 1200px; }
.card { background: var(--panel); border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.card .card { background: var(--panel-header) !important; }
.card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.hint { color: var(--text-2); font-size: 13px; margin: 4px 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-2); font-weight: 500; font-size: 12px; }
select, input[type=text], input[type=password], textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--input-bg); }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.code { font-family: Consolas, monospace; font-size: 12px; background: var(--panel-header); padding: 6px 8px; border-radius: 6px; direction: ltr; display: inline-block; word-break: break-all; }
.multi { max-height: 140px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; min-width: 200px; }
.multi label { display: block; font-size: 13px; }
.auto { color: var(--green); font-size: 12px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111b21; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 70; font-size: 14px; box-shadow: var(--shadow); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { width: min(440px, calc(100% - 32px)); }
.mobile-only { display: none !important; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(127,127,127,.35); border-radius: 3px; }

@media (max-width: 760px) {
  #sidebar { width: 100%; min-width: 0; max-width: none; border: 0; }
  #chat { display: none; }
  #app.open #sidebar { display: none; }
  #app.open #chat { display: flex; }
  .mobile-only { display: inline-flex !important; }
  .msg { max-width: 85%; }
  #messages { padding: 10px 12px; }
  .head-actions .btn { padding: 5px 8px; }
}
