/* X10 Chat — lightweight CSS (Classic Blue brand, มือถือสเปกต่ำใช้ลื่น) */
:root {
  --blue: #0F4C81; --blue-dark: #0A3A63; --blue-light: #E8F0F8;
  --bg: #F4F6F9; --card: #FFFFFF; --text: #1E293B; --muted: #64748B;
  --border: #E2E8F0; --green: #16A34A; --red: #DC2626; --amber: #D97706;
  --radius: 12px; --shadow: 0 1px 3px rgba(15,76,129,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', 'Leelawadee UI', 'Noto Sans Thai', 'Myanmar Text', 'Khmer UI', 'Lao UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; overflow: hidden;
}
/* พม่า/ไทใหญ่ ต้องการ line-height สูงกว่า */
html[lang="my"] body, html[lang="shn"] body { line-height: 1.8; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.w100 { width: 100%; }
.small-text { font-size: 12px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; text-align: center; }
.divider { border-top: 1px solid var(--border); margin: 12px 0; }
.big-emoji { font-size: 56px; }
.mini-hint { font-weight: 400; font-size: 10px; }

/* ---------- buttons / inputs ---------- */
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 9px 16px; border-radius: 8px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-dark); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.icon-btn {
  border: none; background: transparent; font-size: 19px; cursor: pointer;
  padding: 7px; border-radius: 8px; line-height: 1; color: var(--text);
}
.icon-btn:active { background: var(--blue-light); }
.icon-btn.send { color: var(--blue); font-size: 22px; }
.icon-btn.recording { background: var(--red); color: #fff; border-radius: 50%; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
input, textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: var(--card); color: var(--text); margin-bottom: 8px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
input[type=color] { height: 42px; padding: 4px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0 6px 0 0; }
label { font-size: 14px; }

/* ---------- login ---------- */
.login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--blue) 0%, var(--blue-dark) 100%); padding: 16px;
}
.login-card {
  background: var(--card); border-radius: 16px; padding: 32px 28px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-logo { font-size: 52px; }
.login-card h1 { color: var(--blue); margin: 4px 0 2px; }
.login-card p { margin-bottom: 18px; }
.login-card .btn { margin-top: 8px; }

/* ---------- layout ---------- */
.app { display: flex; height: 100%; height: 100dvh; }
.sidebar {
  width: 280px; background: var(--blue-dark); color: #fff; display: flex; flex-direction: column;
  flex-shrink: 0; z-index: 40;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; }
.brand { font-weight: 700; font-size: 17px; }
.sidebar .icon-btn { color: #fff; }
.sidebar-me {
  display: flex; gap: 10px; align-items: center; margin: 0 10px 8px; padding: 8px;
  border-radius: 10px; background: rgba(255,255,255,.08); cursor: pointer;
}
.me-name { font-weight: 600; font-size: 14px; }
.me-status { font-size: 12px; color: #B9CBDD; }
.side-nav { display: flex; gap: 4px; margin: 0 10px 8px; }
.side-nav .nav-btn {
  flex: 1; border: none; background: rgba(255,255,255,.08); color: #fff; font-size: 17px;
  padding: 7px 0; border-radius: 8px; cursor: pointer;
}
.side-nav .nav-btn.active { background: var(--blue); }
.side-search { margin: 0 10px 8px; width: calc(100% - 20px); background: rgba(255,255,255,.12); border: none; color: #fff; }
.side-search::placeholder { color: #A8BDD1; }
.side-scroll { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.side-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8FAAC4;
  padding: 12px 14px 4px; font-weight: 700;
}
.chan-item, .user-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px;
  color: #D9E4EE;
}
.chan-item:active, .chan-item:hover, .user-item:hover { background: rgba(255,255,255,.08); }
.chan-item.active { background: var(--blue); color: #fff; font-weight: 600; }
.chan-item .dot { margin-left: auto; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }
.user-item .presence { width: 9px; height: 9px; border-radius: 50%; background: #55677A; flex-shrink: 0; }
.user-item .presence.on { background: #34D399; }
.online-badge { background: #34D399; color: #06331F; font-size: 11px; padding: 1px 7px; border-radius: 10px; margin-left: 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.page-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--card);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.page-head h2 { font-size: 17px; color: var(--blue); }
.head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.head-actions select { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; }
.page-body { flex: 1; overflow-y: auto; padding: 14px; }

/* ---------- chat ---------- */
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.chat-room { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card);
  border-bottom: 1px solid var(--border);
}
.chat-title { flex: 1; min-width: 0; cursor: pointer; }
.chat-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-topic { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; }
.meeting-bar {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: #FEF3C7;
  border-bottom: 1px solid #FDE68A; font-size: 13px; flex-wrap: wrap;
}
.meeting-bar input { flex: 1; min-width: 140px; margin: 0; padding: 6px 10px; font-size: 13px; }
.messages { flex: 1; overflow-y: auto; padding: 12px 12px 4px; display: flex; flex-direction: column; }
.msg { display: flex; gap: 8px; margin-bottom: 2px; padding: 3px 6px; border-radius: 8px; position: relative; }
.msg:hover { background: var(--blue-light); }
.msg .avatar { width: 32px; height: 32px; font-size: 13px; margin-top: 2px; }
.msg.compact .avatar { visibility: hidden; height: 0; margin: 0; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-name { font-weight: 700; font-size: 13.5px; }
.msg-time { font-size: 11px; color: var(--muted); }
.msg-text { font-size: 14.5px; word-wrap: break-word; white-space: pre-wrap; }
.msg-text.deleted { color: var(--muted); font-style: italic; }
.msg-edited { font-size: 11px; color: var(--muted); }
.msg-reply {
  font-size: 12px; color: var(--muted); border-left: 3px solid var(--blue); padding: 2px 8px;
  margin-bottom: 2px; background: var(--blue-light); border-radius: 4px; cursor: pointer;
}
.msg img.msg-image, .msg video.msg-video { max-width: min(320px, 75%); border-radius: 10px; margin-top: 4px; display: block; cursor: pointer; }
.msg img.msg-sticker { width: 120px; height: 120px; object-fit: contain; }
.msg audio { margin-top: 4px; max-width: 260px; height: 40px; }
.msg-file { display: inline-flex; gap: 8px; align-items: center; background: var(--blue-light); padding: 8px 12px; border-radius: 10px; margin-top: 4px; font-size: 13px; color: var(--blue); text-decoration: none; }
.msg.system { justify-content: center; }
.msg.system .msg-sys {
  background: #EEF2F7; color: var(--muted); font-size: 12.5px; padding: 6px 14px; border-radius: 14px;
  max-width: 92%; white-space: pre-wrap; overflow-wrap: break-word;
}
.msg-actions {
  position: absolute; top: -14px; right: 8px; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; display: none; box-shadow: var(--shadow); z-index: 5;
}
.msg:hover .msg-actions { display: flex; }
.msg-actions button { border: none; background: none; padding: 5px 8px; cursor: pointer; font-size: 14px; }
.msg-actions button:hover { background: var(--blue-light); }
.day-sep { text-align: center; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.day-sep span { background: var(--bg); padding: 2px 12px; border-radius: 10px; border: 1px solid var(--border); }
.typing-bar { min-height: 18px; font-size: 12px; color: var(--muted); padding: 0 16px 2px; }
.reply-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--blue-light);
  font-size: 13px; border-top: 1px solid var(--border);
}
.reply-bar span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.composer {
  display: flex; align-items: flex-end; gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--border);
}
.composer textarea {
  flex: 1; margin: 0; resize: none; max-height: 120px; border-radius: 20px; padding: 9px 14px; font-size: 15px;
}

/* ---------- calls ---------- */
.call-panel { background: #0B1F33; padding: 10px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.video-tile { position: relative; background: #16324D; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; }
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
.video-tile .vt-name {
  position: absolute; bottom: 4px; left: 6px; color: #fff; font-size: 12px;
  background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 8px;
}
.video-tile.audio-only { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; }
.call-controls { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

/* ---------- cards / pages ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h3 { font-size: 15px; color: var(--blue); margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.card-head h3 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile .t-num { font-size: 24px; font-weight: 800; color: var(--blue); }
.tile .t-label { font-size: 12px; color: var(--muted); }
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.list-row:last-child { border-bottom: none; }
.list-row .bar { height: 8px; background: var(--blue); border-radius: 4px; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- filters ---------- */
.filter-card { padding: 10px 14px; }
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.filter-row input[type=date] { width: auto; margin: 0; padding: 5px 8px; font-size: 13px; }
.f-drop { position: relative; }
.f-drop summary {
  cursor: pointer; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); list-style: none; user-select: none;
}
.f-drop[open] summary { background: var(--blue-light); border-color: var(--blue); }
.f-drop .check-list {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  padding: 8px; min-width: 200px; max-height: 260px; overflow-y: auto;
}
.check-list label { display: flex; align-items: center; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.check-list label:hover { background: var(--blue-light); }
.check-list.tall { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.check-col label { display: flex; align-items: center; padding: 7px 4px; }
.radio-row { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.radio-row label { display: flex; align-items: center; }

/* ---------- pivot ---------- */
.pivot-wrap { overflow: auto; max-height: 60vh; }
.pivot-wrap table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.pivot-wrap th, .pivot-wrap td { border: 1px solid var(--border); padding: 5px 9px; text-align: right; white-space: nowrap; }
.pivot-wrap th { background: var(--blue-light); color: var(--blue); position: sticky; top: 0; text-align: center; }
.pivot-wrap td:first-child, .pivot-wrap th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); font-weight: 600; }
.pivot-wrap td.hot { background: #DBEAFE; font-weight: 700; }

/* ---------- tables (control panel) ---------- */
.tab-bar { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--border); background: var(--card); padding: 7px 14px; border-radius: 20px;
  cursor: pointer; font-size: 13.5px; font-family: inherit;
}
.tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.tbl th { color: var(--muted); font-size: 12px; }
.pill { font-size: 11.5px; padding: 2px 9px; border-radius: 10px; background: var(--blue-light); color: var(--blue); }
.pill.green { background: #DCFCE7; color: var(--green); }
.pill.red { background: #FEE2E2; color: var(--red); }
.pill.amber { background: #FEF3C7; color: var(--amber); }
code.key-code { background: #F1F5F9; padding: 2px 7px; border-radius: 6px; font-size: 12px; word-break: break-all; white-space: normal; }

/* ---------- stickers ---------- */
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
.sticker-cell { text-align: center; cursor: pointer; padding: 6px; border-radius: 10px; position: relative; }
.sticker-cell:hover { background: var(--blue-light); }
.sticker-cell img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.sticker-cell .st-name { font-size: 11px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sticker-cell .st-del { position: absolute; top: 0; right: 0; font-size: 11px; background: var(--red); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; cursor: pointer; display: none; }
.sticker-cell:hover .st-del { display: block; }
.sticker-pack-head { grid-column: 1/-1; font-size: 12px; font-weight: 700; color: var(--blue); margin-top: 4px; }
.attach-preview { max-height: 220px; overflow: hidden; text-align: center; margin-bottom: 8px; }
.attach-preview img, .attach-preview video { max-width: 100%; max-height: 200px; border-radius: 10px; }

/* ---------- modals / toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,30,50,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.modal {
  background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 420px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal.wide { max-width: 680px; }
.modal h3 { color: var(--blue); margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #1E293B; color: #fff;
  padding: 10px 20px; border-radius: 24px; font-size: 14px; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.3);
  max-width: 90vw; text-align: center;
}

/* ---------- meetings page ---------- */
.meeting-item { cursor: pointer; }
.meeting-item:hover { outline: 2px solid var(--blue-light); }
.summary-md { font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word; }
.summary-md h1, .summary-md h2 { color: var(--blue); margin: 10px 0 4px; font-size: 16px; }

/* ---------- v2: ภาษา / threads / mention / nested comments / schedule ---------- */
.lang-row { display: flex; gap: 6px; justify-content: center; margin: 6px 0 12px; flex-wrap: wrap; }
.lang-btn {
  padding: 5px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--card);
  cursor: pointer; font-size: 13px; font-family: inherit; color: var(--text);
}
.lang-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.modal .lang-row, .sidebar .lang-row { justify-content: flex-start; }

.nav-dot {
  position: absolute; top: 4px; right: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--card);
}
.side-nav .nav-btn, .bottom-nav .nav-btn { position: relative; }

/* คอมเมนต์ซ้อนแบบ Facebook (สูงสุด 3 ชั้น) */
/* คอมเมนต์ซ้อน: เยื้องลึกขึ้นทุกชั้น (--d = เลขชั้น) จำกัดความกว้างสูงสุดกันจอแคบ */
.msg.nested {
  margin-left: min(calc(var(--d) * 32px), 256px);
  border-left: 2px solid var(--border); padding-left: 8px;
}
.msg.nested .avatar { width: 26px; height: 26px; font-size: 11px; }
.depth-badge {
  font-size: 10.5px; font-weight: 700; color: var(--blue);
  background: var(--blue-light); border-radius: 8px; padding: 1px 7px; margin-left: 2px;
}
.msg-comment-btn {
  border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer;
  padding: 1px 6px; font-weight: 600; font-family: inherit;
}
.msg-comment-btn:hover { color: var(--blue); }
.mention { color: var(--blue); font-weight: 700; background: var(--blue-light); border-radius: 4px; padding: 0 3px; }
.mention-pop {
  position: absolute; bottom: 64px; left: 12px; right: 12px; max-width: 380px; max-height: 220px;
  overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 -6px 24px rgba(0,0,0,.15); z-index: 60;
}
.mention-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.mention-item:hover, .mention-item.sel { background: var(--blue-light); }
.chat-room { position: relative; }

.thread-item { cursor: pointer; }
.thread-item.unread { border-left: 4px solid var(--red); }
.thread-item:hover { outline: 2px solid var(--blue-light); }

.announce-item { border-left: 4px solid var(--amber); padding: 8px 12px; margin-bottom: 10px; background: #FFFBEB; border-radius: 8px; }
.announce-item h4 { color: var(--blue-dark); margin-bottom: 4px; }
.announce-item .a-body { white-space: pre-wrap; font-size: 14px; }

/* v3: ปุ่มอัปโหลดใหญ่ + คำแปล + unread badge */
.upload-big {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed var(--blue); border-radius: 14px; padding: 26px 14px; cursor: pointer;
  background: var(--blue-light); margin-bottom: 10px; text-align: center; font-weight: 600; color: var(--blue-dark);
}
.upload-big:hover { background: #DBEAFE; }
.upload-big .up-icon { font-size: 40px; }
#share-result { display: flex; gap: 6px; margin-top: 8px; }
#share-result input { flex: 1; font-size: 13px; color: var(--blue-dark); }
.msg-translation {
  margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--green, #10B981);
  background: #ECFDF5; border-radius: 6px; font-size: 14px; white-space: pre-wrap;
}
.msg-translation .tr-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chan-unread {
  background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700;
  padding: 1px 7px; margin-left: auto;
}
.speaking { color: var(--blue) !important; }

/* ---------- nav ---------- */
.bottom-nav { display: none; }
.only-mobile { display: none; }

/* ================= MOBILE ================= */
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .only-mobile { display: inline-flex; }
  .only-desktop { display: none; }
  .sidebar {
    position: fixed; inset: 0 22% 0 0; max-width: 320px; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .app { flex-direction: column; }
  .main { padding-bottom: 58px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card);
    border-top: 1px solid var(--border); z-index: 50; padding-bottom: env(safe-area-inset-bottom);
  }
  .nav-btn {
    flex: 1; border: none; background: none; padding: 7px 2px 5px; font-size: 19px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--muted); font-family: inherit;
  }
  .nav-btn span { font-size: 10px; }
  .nav-btn.active { color: var(--blue); font-weight: 700; }
  .msg-actions { display: flex; opacity: 0; pointer-events: none; }
  .msg.show-actions .msg-actions { opacity: 1; pointer-events: auto; }
  .messages { padding: 8px 6px 4px; }
  .page-body { padding: 10px; }
  /* mobile UX: ปุ่มใหญ่ กดง่าย + modal แบบ bottom sheet */
  .icon-btn { font-size: 22px; padding: 9px; }
  .composer textarea { font-size: 16px; }
  .msg-text { font-size: 15.5px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .btn { padding: 11px 18px; }
  .msg.nested { margin-left: min(calc(var(--d) * 16px), 112px); }
  .mention-pop { bottom: 60px; }
}
