:root {
  --bg: #f4f6fb; --panel: #fff; --border: #e2e6ef; --text: #1d2433; --muted: #6b7489;
  /* Bộ nhận diện OFT-Teams365: xanh lá + đỏ (lấy từ logo) */
  --brand-green: #10934f; --brand-green-dark: #0b7a40; --brand-red: #e3172f; --brand-blue: #1b5f73;
  --accent: var(--brand-green); --accent-dark: #0a6b38; --accent-soft: #e4f3ea; --accent-soft-2: #d3ecdd;
  --primary: var(--brand-green); --primary-dark: var(--brand-green-dark); --danger: #d43c3c; --warn: #e08a00; --ok: #1f9d55;
  --col-todo: #8792a8; --col-doing: #2f5bea; --col-review: #b65ce0; --col-done: #1f9d55;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,30,60,.06), 0 2px 8px rgba(20,30,60,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; }

/* Nút & ô nhập */
.btn { border: 1px solid var(--border); background: #fff; padding: 7px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f2f7; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #f0c8c8; }
.btn.danger:hover { background: #fdf0f0; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--primary); padding: 4px 6px; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,147,79,.15); }
input:disabled, select:disabled, textarea:disabled { background: #f6f7fa; color: var(--text); }
textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 20px; margin: 4px 0 8px; }

/* Đăng nhập */
.auth-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--panel); width: 380px; max-width: 100%; padding: 32px; border-radius: 14px; box-shadow: var(--shadow); }
.auth-card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-card .logo img { width: 36px; }
.auth-card h1 { font-size: 20px; }
.auth-card p { margin: 0 0 18px; }
.auth-card .btn { width: 100%; padding: 10px; }

/* Khung chính */
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 18px; gap: 18px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand img { width: 26px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.nav a:hover { background: #f0f2f7; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--primary); }
.top-right { display: flex; align-items: center; gap: 8px; position: relative; }
.icon-btn { position: relative; border: 0; background: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.icon-btn:hover { background: #f0f2f7; }
.badge { position: absolute; top: 2px; right: 0; background: var(--brand-red); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.badge[hidden] { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px 8px; border-radius: 20px; }
.user-chip:hover { background: #f0f2f7; }
.avatar { width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.empty { background: #dfe3ec !important; color: var(--muted); }
/* Ảnh đại diện: ảnh phủ lên chữ viết tắt (ảnh lỗi → còn chữ) */
.avatar.has-img { position: relative; overflow: hidden; }
.avatar.has-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.msg-av .avatar[data-uid], .chat-head .avatar[data-uid], .oc-av .avatar[data-uid], .act-av .avatar[data-uid], .mem-table .avatar[data-uid], .comment .avatar[data-uid] { cursor: pointer; }
.avatar-xl .avatar { width: 88px; height: 88px; font-size: 30px; }
/* Trang Tài khoản */
.pf-hero { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.pf-photo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pf-photo-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.pf-main { flex: 1; min-width: 260px; }
.pf-name { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.pf-status { display: flex; gap: 6px; align-items: center; margin: 12px 0 6px; max-width: 560px; }
.pf-status input { flex: 1; }
.pf-status-ico { font-size: 16px; }
.pf-since { font-size: 12.5px; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.pf-field label { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: #616161; margin-bottom: 4px; font-weight: 600; }
.pf-field.wide { grid-column: 1 / -1; }
.pf-field textarea { width: 100%; }
.pf-ro { padding: 7px 0; min-height: 34px; }
.pf-lock { display: inline-flex; color: #8a8886; }
.pf-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.acc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-actions .btn { flex: 0 0 auto; }
.pf-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pf-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
.pf-stat:hover { border-color: var(--accent); }
.pf-stat b { font-size: 24px; line-height: 1.1; }
.pf-stat span { font-size: 12.5px; color: var(--muted); }
.pf-stat.warn b { color: var(--warn); }
.pf-stat.bad b { color: var(--danger); }
.sess-list { display: flex; flex-direction: column; }
.sess-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.sess-row:last-child { border-bottom: 0; }
.sess-ico { font-size: 22px; width: 30px; text-align: center; }
.sess-main { flex: 1; min-width: 0; font-size: 13.5px; }
.sess-main .muted { font-size: 12.5px; }
.sess-cur { font-size: 11.5px; background: var(--accent-soft); color: var(--accent-dark); border-radius: 8px; padding: 1px 8px; margin-left: 4px; }
/* Thẻ hồ sơ */
.pc-modal { max-width: 440px; }
.pc { position: relative; }
.pc-close { position: absolute; top: 10px; right: 10px; }
.pc-head { display: flex; gap: 16px; align-items: center; padding: 22px 22px 14px; border-bottom: 1px solid var(--border); }
.pc-status { margin-top: 6px; font-size: 13px; background: var(--accent-soft); border-radius: 6px; padding: 4px 8px; display: inline-block; }
.pc-body { padding: 12px 22px; }
.pc-row { display: flex; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.pc-row > span { width: 120px; flex-shrink: 0; color: var(--muted); }
.pc-bio { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); white-space: pre-wrap; font-size: 13.5px; }
.pc-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 22px 18px; }
/* Thành viên */
.mem-search { max-width: 360px; margin-bottom: 10px; }
.uf-photo { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.uf-sec { font-weight: 700; font-size: 13px; margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.uf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.uf-grid .field.wide { grid-column: 1 / -1; }
.dropdown { position: absolute; top: 46px; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgba(20,30,60,.15); min-width: 200px; z-index: 30; overflow: hidden; }
.dropdown button.item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; cursor: pointer; }
.dropdown button.item:hover { background: #f4f6fb; }
.dropdown button.item .dd-ico { vertical-align: -3px; margin-right: 9px; color: #616161; }
.notif-panel { width: 360px; max-height: 460px; overflow-y: auto; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.notif { padding: 10px 14px; border-bottom: 1px solid #f0f2f7; cursor: pointer; }
.notif:hover { background: #f7f8fc; }
.notif.unread { background: var(--accent-soft); }
.notif .time { font-size: 12px; color: var(--muted); }

/* Khung 3 vùng giống Microsoft Teams: thanh nút | danh sách | chi tiết */
.shell { display: grid; grid-template-columns: 68px clamp(220px, var(--pane-w, 320px), 50vw) minmax(0, 1fr); height: calc(100vh / var(--zoom, 1)); overflow: hidden; position: relative; }
/* Thanh kéo đổi độ rộng danh sách: nằm đè lên mép phải của vùng 2 */
.pane-resizer { position: absolute; top: 0; bottom: 0; left: calc(68px + clamp(220px, var(--pane-w, 320px), 50vw) - 3px); width: 6px; cursor: col-resize; z-index: 15; }
.pane-resizer:hover, .shell.resizing .pane-resizer { background: var(--accent); opacity: .5; }
.shell.resizing { user-select: none; cursor: col-resize; }
/* Menu ⋯ của kênh / cuộc trò chuyện: ghim, ẩn, tắt tiếng */
.tree-pinned { margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid #e6e6e6; }
.tree-sec { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #616161; padding: 6px 8px 4px; }
.tree-sec svg { width: 14px; height: 14px; }
.chan.pinned-row { padding-left: 14px; }
.chan-team-hint { color: #8a8886; font-size: 12px; }
.chan.is-hidden, .conv.is-hidden { opacity: .55; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.link-btn:hover { text-decoration: underline; }
.tree-hidden-toggle { display: block; margin: 8px 12px; font-size: 12.5px; }
.conv { position: relative; }
.conv-more { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: #fff; box-shadow: 0 0 0 1px #e0e0e0; }
.conv:hover .conv-more, .conv-more:focus { display: inline-flex; }
.conv:hover .conv-time { visibility: hidden; }
.conv-flag { display: inline-flex; color: #8a8886; }
.conv-flag svg { width: 13px; height: 13px; }
.unread.muted-badge { background: #b0b0b0 !important; }
/* Cửa sổ riêng (Mở trong cửa sổ mới): chỉ nội dung */
html.popout .rail, html.popout .pane, html.popout .pane-resizer, html.popout .chat-head .back { display: none !important; }
html.popout .shell { grid-template-columns: minmax(0, 1fr) !important; }
html.popout .shell .chat-main { display: flex !important; }
.rail { background: #ebebf0; display: flex; flex-direction: column; align-items: center; padding: 8px 0 10px; gap: 2px; position: relative; z-index: 20; border-right: 1px solid #e0e0e0; }
.rail-brand { margin-bottom: 8px; display: flex; }
.rail-brand img { width: 36px; height: 36px; }
/* Logo + chữ thương hiệu */
.brand-lockup { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 22px; }
.brand-lockup img { width: 84px; height: 84px; }
.wordmark { font-weight: 800; font-size: 26px; letter-spacing: -.5px; color: var(--brand-green); line-height: 1.1; white-space: nowrap; }
.wordmark b { color: var(--brand-red); font-weight: 800; }
.rail-btn { width: 60px; padding: 7px 0 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #616161; font-size: 10.5px; border-radius: 6px; position: relative; text-align: center; line-height: 1.2; }
.rail-btn:hover { background: rgba(255,255,255,.7); color: var(--accent); }
.rail-btn.active { color: var(--accent); font-weight: 600; }
.rail-btn.active::before { content: ''; position: absolute; left: -4px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.rail-ico { position: relative; display: flex; }
.rail .badge { top: -7px; right: -11px; }
.rail-me { border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 50%; }
.rail-me:hover { background: rgba(255,255,255,.7); }
.rail-me .avatar { width: 32px; height: 32px; }
.rail .dropdown { top: auto; bottom: 8px; left: 64px; right: auto; }
.pane { background: #f5f5f5; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 10px; }
.pane-head h2 { font-size: 18px; font-weight: 700; }
.pane-body { flex: 1; overflow-y: auto; min-height: 0; padding: 0 8px 12px; }
.pane-group { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 10px 8px 6px; color: #242424; }
.pane-group-ico { display: inline-flex; color: #616161; }
.pane-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 6px; color: #242424; margin: 1px 0; }
.pane-item:hover { background: #fff; text-decoration: none; }
.pane-item.active { background: #fff; font-weight: 600; box-shadow: 0 0 0 1px #e0e0e0; }
.pane-item-ico { width: 20px; display: inline-flex; justify-content: center; color: #616161; }
.pane-item.active .pane-item-ico { color: var(--accent); }
/* Công việc — cây Nhóm › Kênh (giống Teams) */
.pane-tools { display: flex; gap: 2px; }
.pane-tools .icon-btn.compose { width: auto; height: 34px; padding: 0 7px 0 8px; display: inline-flex; align-items: center; gap: 4px; color: #424242; border-radius: 6px; font-size: 14px; }
.pane-tools .icon-btn.compose svg { width: 22px; height: 22px; flex-shrink: 0; }
.pane-tools .icon-btn.compose:hover { background: #e8e8e8; color: var(--accent); }
.pane-tools .icon-btn.compose .caret { font-size: 11px; color: #616161; }
.team-tree { padding: 0 6px 12px; }
.team { margin-bottom: 4px; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 4px; border-radius: 4px; cursor: pointer; user-select: none; }
.team-row:hover { background: #fff; }
.team-chev { display: inline-flex; color: #616161; transition: transform .15s; transform: rotate(90deg); width: 12px; }
.team.collapsed .team-chev { transform: rotate(0deg); }
.team.collapsed .team-channels { display: none; }
.team-badge { border-radius: 4px; color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; letter-spacing: -.3px; }
.team-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: #242424; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-channels { padding: 1px 0 2px; }
.chan { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 30px; border-radius: 4px; color: #424242; font-size: 13.5px; position: relative; }
.chan:hover { background: #fff; text-decoration: none; }
.chan.active { background: #fff; color: #242424; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chan-ico { display: inline-flex; color: #616161; }
.chan.active .chan-ico { color: var(--accent); }
.chan-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-count { font-size: 11.5px; color: #8a8886; font-weight: 400; }
.tree-more { border: 0; background: none; color: #616161; width: 24px; height: 22px; border-radius: 4px; cursor: pointer; display: none; align-items: center; justify-content: center; flex-shrink: 0; }
.team-row:hover .tree-more, .chan:hover .tree-more, .chan.active .tree-more { display: inline-flex; }
.chan:hover .chan-count { display: none; }
.tree-more:hover { background: #e8e8e8; color: #242424; }
/* Menu nổi */
.pop-menu { position: fixed; z-index: 60; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px; min-width: 210px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 4px; font: inherit; font-size: 13.5px; color: #242424; cursor: pointer; text-align: left; }
.pop-item:hover:not(:disabled) { background: #f5f5f5; }
.pop-item:disabled { color: #b3b3b3; cursor: default; }
.pop-item.danger:not(:disabled) { color: var(--danger); }
.pop-ico { display: inline-flex; color: #616161; }
.pop-item.danger .pop-ico { color: inherit; }
.pop-hint { margin-left: auto; font-size: 11.5px; color: #8a8886; padding-left: 16px; }
.pop-sep { height: 1px; background: #edebe9; margin: 4px 2px; }
/* Tiêu đề kênh ở vùng 3 */
.chan-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chan-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.chan-sub { font-size: 12px; color: var(--muted); }
.chan-count-lg { font-size: 14px; }
.o-chan-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-left: 10px; }
.o-chan-pick select { width: auto; min-width: 200px; padding: 4px 8px; font-size: 13px; }
/* Cài đặt — vùng 2 (giống Teams) */
.set-search { padding: 0 12px 10px; }
.set-search input { background: #fff; border-color: #e0e0e0; font-size: 13px; padding: 6px 10px; }
.set-list { padding: 0 10px 8px; }
.set-group { font-size: 12px; font-weight: 600; color: #616161; padding: 14px 10px 4px; }
.set-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 4px; color: #242424; font-size: 13.5px; margin: 1px 0; }
.set-item:hover { background: #fff; text-decoration: none; }
.set-item.active { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.set-ico { display: inline-flex; color: #616161; }
.set-item.active .set-ico { color: var(--accent); }
.set-foot { margin: 8px 10px 12px; flex-shrink: 0; }
/* Cài đặt — vùng 3 */
.page.set-bg { background: #f5f5f5; }
.set-page { max-width: 1100px; }
.set-title { font-size: 18px; font-weight: 700; margin: 0 0 14px; }
.set-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; padding: 16px 20px 18px; margin-bottom: 12px; }
.set-card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.set-card-ico { display: inline-flex; color: #424242; margin-top: 1px; }
.set-card-title { font-size: 14px; color: #242424; }
.set-card-desc { font-size: 12px; color: #616161; margin-top: 2px; }
.set-card-body { padding-left: 30px; }
.set-check { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; cursor: pointer; font-size: 13.5px; }
.set-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.set-check small, .set-row small { display: block; color: #616161; font-size: 12px; margin-top: 1px; }
.set-check.disabled { cursor: default; color: #8a8886; }
.set-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.apk-upd-row { margin-top: 10px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-zoom { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 13.5px; }
.set-zoom-label { margin-right: 6px; }
.set-zoom-range { flex: 1; min-width: 120px; max-width: 320px; accent-color: var(--accent); }
.set-zoom-btn { flex: none; }
.set-zoom-val { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.set-tile { width: 150px; border: 1px solid #e0e0e0; border-radius: 4px; cursor: pointer; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); overflow: hidden; }
.set-tile:hover { border-color: #c7c7c7; }
.set-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.set-tile-art { padding: 10px 10px 4px; }
.set-tile-art svg { width: 100%; height: auto; display: block; border-radius: 2px; }
.set-tile-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 4px 10px 8px; font-size: 12.5px; color: #424242; }
.set-tile-foot input { accent-color: var(--accent); margin: 0; }
@media (max-width: 600px) {
  .set-zoom { flex-wrap: wrap; } .set-zoom-label { flex-basis: 100%; } .set-zoom-range { max-width: none; }
  /* Ô chọn có hình minh hoạ: thu nhỏ hình cho đỡ chiếm chỗ trên điện thoại */
  .set-tile-art { padding: 6px 8px 2px; }
  .set-tile-art svg { height: 46px; width: auto; max-width: 100%; margin: 0 auto; }
  .set-tile-foot { padding: 2px 8px 6px; font-size: 12px; }
}
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; font-size: 13.5px; border-bottom: 1px solid #f3f3f3; }
.set-row:last-child { border-bottom: 0; }
.set-row > div:first-child { flex: 1; min-width: 0; }
.set-select { width: auto; min-width: 240px; }
/* Trang Thông báo và hoạt động (giống Teams) */
.set-section { font-size: 13px; font-weight: 700; color: #242424; margin: 18px 0 10px 4px; }
.set-section:first-of-type { margin-top: 4px; }
.set-sub { font-size: 13px; color: #424242; margin: 14px 0 8px; }
.set-inline { display: flex; align-items: center; gap: 6px; }
.set-inline .set-select { min-width: 180px; }
.set-volume input[type=range] { width: 180px; accent-color: var(--accent); padding: 0; border: 0; }
.set-volume #sound-vol-n { min-width: 36px; text-align: right; font-size: 12.5px; }
.set-row-ico { display: flex; gap: 12px; align-items: flex-start; }
.set-row-ico > svg { flex-shrink: 0; margin-top: 1px; color: #424242; }
.set-note { font-size: 12.5px; color: #616161; margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: #f6f7f9; }
.set-note.ok { background: var(--accent-soft); color: var(--accent-dark); }
.set-note.warn { background: #fff4e0; color: #8a5300; }
.set-note .muted { display: block; margin-top: 2px; }
.set-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: #424242; user-select: none; }
.set-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-switch i { width: 40px; height: 20px; border-radius: 10px; border: 1px solid #616161; position: relative; transition: background .15s, border-color .15s; flex-shrink: 0; }
.set-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #616161; transition: transform .15s, background .15s; }
.set-switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.set-switch input:checked + i::after { transform: translateX(20px); background: #fff; }
.set-switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.set-input { width: 360px !important; max-width: 100%; }
.set-num { white-space: nowrap; font-size: 13px; color: #424242; }
.set-num input { width: 80px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.set-kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 13.5px; }
.set-kv > div:nth-child(odd) { color: #616161; }
.set-kv code, .set-card-desc code { background: #f3f3f3; border-radius: 3px; padding: 1px 5px; font-size: 12.5px; margin-right: 4px; }
.set-actions { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.set-table th, .set-table td { padding: 7px 10px; font-size: 13px; }
.set-card.about { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 24px; max-width: 560px; }
.set-card.about p { margin: 8px 0 0; color: #424242; }
.btn svg { vertical-align: -3px; }
/* Màn đăng nhập: tên tổ chức + lời nhắn */
.auth-org { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.auth-org:empty { display: none; }
.auth-notice { margin-top: 14px; padding: 9px 12px; background: var(--accent-soft); color: var(--accent-dark); border-radius: 8px; font-size: 13px; }
.auth-notice[hidden] { display: none; }
/* Chế độ hiển thị gọn (Cài đặt → Giao diện) */
body.dense table.data th, body.dense table.data td { padding: 5px 10px; }
body.dense .act, body.dense .pane .conv { padding-top: 5px; padding-bottom: 5px; }
body.dense .pane-item, body.dense .set-item { padding-top: 4px; padding-bottom: 4px; }
body.dense .oc-msg { margin-top: 8px; }
body.dense .oc-bubble { padding: 5px 10px; }
body.dense .order-field { padding-bottom: 6px; }
body.dense .page { padding: 14px 16px; }
body.dense .kboard .card, body.dense .card { padding: 6px 9px; margin-bottom: 5px; }
.pane-new { margin: 12px 0 0 14px; }
.pane-empty { color: var(--muted); text-align: center; padding: 30px 12px; font-size: 13px; }
.pane-chips { display: flex; gap: 6px; padding: 0 16px 10px; flex-wrap: wrap; }
.chip { border: 1px solid #d1d1d1; background: #fff; border-radius: 14px; padding: 2px 10px; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-btn.small { width: 30px; height: 30px; font-size: 13px; border-radius: 6px; color: #616161; }
.pane .chat-side-head { padding: 0 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.pane .conv-list { padding: 0 6px 12px; }
.pane .conv { border-bottom: 0; border-radius: 6px; margin: 1px 0; }
.pane .conv:hover { background: #fff; }
.pane .conv.active { background: #fff; box-shadow: 0 0 0 1px #e0e0e0; }
.page { padding: 20px 22px; min-width: 0; min-height: 0; overflow: auto; background: var(--bg); }
.page.flush { padding: 0; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.page.flush > .chat-main, .page.flush > .act-detail { flex: 1; min-height: 0; }
.main-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 30px; min-height: 60vh; }
.main-empty-ico { font-size: 44px; color: #c8c6c4; }
.main-empty-ico svg { width: 56px; height: 56px; }
.avatar-lg .avatar { width: 56px; height: 56px; font-size: 20px; }
/* Hoạt động (Thông báo) */
/* Thẻ thông báo (giống Hoạt động của Teams): ảnh + huy hiệu loại · tiêu đề (≤2 dòng) + giờ · trích dẫn (≤2 dòng) · vị trí (1 dòng) */
.act { display: flex; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 6px; cursor: pointer; margin: 1px 0; position: relative; }
.act:hover { background: #fff; }
.act.active { background: #fff; box-shadow: 0 0 0 1px #e0e0e0; }
.act.is-unread::before { content: ''; position: absolute; left: 4px; top: 24px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.act-av { position: relative; flex-shrink: 0; width: 34px; height: 34px; margin-top: 1px; }
.act-av .avatar { width: 34px; height: 34px; font-size: 12px; margin: 0; }
.avatar.sys { background: #e8e8e8; font-size: 15px; margin: 0; }
.act-kind { position: absolute; right: -4px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%; border: 2px solid #f5f5f5; background: var(--accent); font-size: 9px; color: #fff; display: flex; align-items: center; justify-content: center; }
.act-kind svg { display: block; }
.act-kind.k-order_mention { background: #c4314b; }
.act-kind.k-order_reply { background: #0f6cbd; }
.act-kind.k-order_reaction { background: #e3008c; }
.act-kind.k-order_assigned, .act-kind.k-assigned { background: #107c10; }
.act-kind.k-order_due, .act-kind.k-due { background: #ca5010; }
.act-kind.k-app_request, .act-kind.k-app_decided { background: #8764b8; }
.act-kind.k-team_request, .act-kind.k-team_approved, .act-kind.k-team_declined { background: #038387; }
.act-body { flex: 1; min-width: 0; }
.act-top { display: flex; gap: 8px; align-items: flex-start; }
.act-title { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; color: #242424; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.act.is-unread .act-title { font-weight: 700; }
.act-time { font-size: 11.5px; color: #616161; flex-shrink: 0; white-space: nowrap; line-height: 1.6; }
.act-preview { font-size: 13px; line-height: 1.35; color: #424242; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; margin-top: 2px; }
.act-where { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: #616161; margin-top: 3px; min-width: 0; }
.act-where > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.act-where > span.w-last { flex-shrink: 0; max-width: 45%; }
.act-where .sep { flex-shrink: 0; opacity: .7; }
.act-detail { display: flex; flex-direction: column; min-height: 0; background: #f5f5f5; }
.act-detail-head { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: #fff; border-bottom: 1px solid #e0e0e0; }
.act-detail-head .back { display: none; }
.act-detail-ico { width: 36px; height: 36px; border-radius: 6px; background: #1f4e79; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.act-detail-title { font-weight: 700; font-size: 15px; }
.act-thread { flex: 1; min-height: 0; display: flex; justify-content: center; padding: 0 16px; }
.act-thread .order-side.oc { position: static; height: auto; align-self: stretch; flex: 1; max-width: 860px; border: 0; border-left: 1px solid #e0e0e0; border-right: 1px solid #e0e0e0; border-radius: 0; box-shadow: 0 0 6px rgba(0,0,0,.04); }
.act-thread .oc-head { display: none; }
/* Chuỗi hội thoại kiểu bài đăng trong kênh Teams: nền xám, một thẻ trắng chứa bài đăng + trả lời, ô trả lời bên dưới */
.act-thread .order-side.oc.tt { max-width: none; border: 0; box-shadow: none; background: #f5f5f5; }
.tt .oc-list { background: #f5f5f5; padding: 18px 16px 8px; }
.tt .oc-list > * { max-width: 880px; margin-left: auto; margin-right: auto; background: #fff; border-left: 1px solid #e6e6e6; border-right: 1px solid #e6e6e6; }
.tt .oc-list > :first-child { border-top: 1px solid #e6e6e6; border-radius: 8px 8px 0 0; }
.tt .oc-list > :last-child { border-bottom: 1px solid #e6e6e6; border-radius: 0 0 8px 8px; padding-bottom: 14px; }
.tt-post { padding: 16px 20px 14px; border-bottom: 1px solid #ececec !important; }
.tt-post-head { display: flex; align-items: center; gap: 10px; }
.tt-post-head .avatar { width: 32px; height: 32px; font-size: 11.5px; }
.tt-name { font-size: 13.5px; color: #242424; }
.tt-post-body { margin: 8px 0 10px 42px; font-size: 14px; line-height: 1.5; }
.tt-mention { color: var(--accent); }
.tt-post-head + .tt-ref { margin-top: 10px; }
/* Trường "Người (chọn nhiều)" */
.people-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pp-chips { display: contents; }
.people-pick .person-chip { padding-right: 4px; }
.pp-x { border: 0; background: transparent; color: #8a8886; cursor: pointer; font-size: 11px; padding: 2px 4px; border-radius: 4px; line-height: 1; }
.pp-x:hover { background: rgba(0,0,0,.08); color: #c4314b; }
.pp-add { width: auto; min-width: 140px; }
.person-multi { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tt-ref { margin-left: 42px; display: inline-flex; align-items: center; gap: 12px; max-width: calc(100% - 42px); background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; padding: 8px 14px 8px 8px; cursor: pointer; text-align: left; box-shadow: 0 1px 2px rgba(0,0,0,.06); font: inherit; color: inherit; }
.tt-ref:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.tt-ref-ico { width: 34px; height: 34px; border-radius: 6px; background: #1f4e79; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tt-ref-ico svg { width: 20px; height: 20px; }
.tt-ref-txt { display: flex; flex-direction: column; min-width: 0; }
.tt-ref-txt b { font-size: 14px; }
.tt-ref-txt small { font-size: 12px; color: #616161; }
.tt-ref-pills { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.tt-ref-pills .opt { font-size: 11.5px; }
/* Trả lời: căn trái hết, không bong bóng, có ảnh + tên (kể cả tin của mình) */
.tt .oc-msg { margin-top: 0; padding: 10px 20px 4px; gap: 10px; }
.tt .oc-msg.grouped { padding-top: 3px; margin-top: 0; }
.tt .oc-msg:hover { background: #fafafa; }
.tt .oc-msg .oc-col { max-width: calc(100% - 42px); flex: 1; }
.tt .oc-bubble, .tt .oc-bubble:hover { background: transparent; padding: 0; }
.tt .oc-meta { margin: 0 0 2px; }
.tt .oc-day { text-align: center; margin-top: 0; padding: 10px 0 2px; color: #8a8886; }
.tt-empty { padding: 14px 20px; color: #8a8886; font-size: 13px; text-align: left; margin-top: 0; }
.tt .oc-composer { max-width: 880px; width: calc(100% - 32px); margin: 8px auto 14px; }
.tt .oc-msg.flash { animation: oc-flash 2.4s ease-out; }
@media (max-width: 600px) {
  .tt .oc-list { padding: 8px 6px 4px; }
  .tt-post { padding: 12px 12px 10px; }
  .tt .oc-msg { padding-left: 12px; padding-right: 12px; }
  .tt-post-body { margin-left: 0; }
  .tt-ref { margin-left: 0; max-width: 100%; }
  .tt .oc-composer { width: calc(100% - 12px); margin: 6px auto 8px; }
}
.oc-msg.flash .oc-bubble { animation: oc-flash 2.4s ease-out; }
@keyframes oc-flash { 0%, 40% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar h2 { font-size: 19px; margin-right: auto; }
.toolbar select, .toolbar input { width: auto; min-width: 170px; }
.toolbar input[type=checkbox] { min-width: 0; margin: 0; }
.toolbar label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

/* Bảng Kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; align-items: start; }
.column { background: #e9ecf3; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.column.drop-over { background: #dfe6fb; outline: 2px dashed var(--primary); }
.column-head { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 2px 4px 10px; }
.column-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.column-head .count { margin-left: auto; background: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.card { background: #fff; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; border-left: 3px solid transparent; }
.card:hover { box-shadow: 0 2px 10px rgba(20,30,60,.12); }
.card.dragging { opacity: .5; }
.card.p-urgent { border-left-color: var(--danger); }
.card.p-high { border-left-color: var(--warn); }
.card .title { font-weight: 600; margin-bottom: 6px; word-break: break-word; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .meta .spacer { flex: 1; }
.card .project-tag { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.due { padding: 1px 6px; border-radius: 4px; background: #f0f2f7; }
.due.overdue { background: #fde8e8; color: var(--danger); font-weight: 600; }
.due.today { background: #fff2dc; color: #a36300; font-weight: 600; }
.prio { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .02em; }
.prio.urgent { background: #fde8e8; color: var(--danger); }
.prio.high { background: #fff2dc; color: #a36300; }
.prio.normal { background: #eef1f6; color: #5a6478; }
.prio.low { background: #eef7f1; color: #3a7a52; }
.status-pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.empty-col { color: var(--muted); text-align: center; font-size: 13px; padding: 20px 0; }

/* Bảng dữ liệu */
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid #eef0f5; vertical-align: middle; }
table.data th { font-size: 12.5px; color: var(--muted); font-weight: 700; background: #fafbfd; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: #f7f8fc; }
table.data td.num { text-align: center; font-variant-numeric: tabular-nums; }
table.data td.num.bad { color: var(--danger); font-weight: 700; }
.person { display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; background: #e9ecf3; padding: 3px; border-radius: 9px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.progress { height: 8px; background: #eef0f5; border-radius: 4px; overflow: hidden; min-width: 100px; }
.progress > div { height: 100%; background: var(--ok); }
.tag-off { font-size: 12px; background: #f0f2f7; color: var(--muted); padding: 1px 7px; border-radius: 4px; }
.tag-admin { font-size: 12px; background: var(--accent-soft); color: var(--primary); padding: 1px 7px; border-radius: 4px; font-weight: 600; }

/* Hộp thoại */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,28,45,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: 920px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-foot .left { margin-right: auto; }
.task-layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; }
.section-title { font-weight: 700; font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.att { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.att a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .size { font-size: 12px; color: var(--muted); }
.feed { max-height: 340px; overflow-y: auto; }
.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment .bubble { background: #f4f6fb; border-radius: 10px; padding: 8px 12px; flex: 1; min-width: 0; }
.comment .who { font-weight: 600; font-size: 13px; }
.comment .who .time { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.comment .text { white-space: pre-wrap; word-break: break-word; }
.sys { font-size: 12.5px; color: var(--muted); margin: 0 0 10px 38px; }
.comment-box { display: flex; gap: 8px; margin-top: 8px; }
.comment-box textarea { min-height: 44px; }
.info-list { font-size: 13px; color: var(--muted); }
.info-list div { margin-bottom: 4px; }

/* Thông báo nổi */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1d2433; color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); }

/* Tin nhắn */
.nav a { position: relative; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; margin-left: 6px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; vertical-align: 1px; }
.nav-badge[hidden] { display: none; }
.chat { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 56px - 40px); background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; align-items: center; border-bottom: 1px solid #f3f4f8; }
.conv:hover { background: #f7f8fc; }
.conv.active { background: var(--accent-soft); }
.conv .avatar { width: 40px; height: 40px; font-size: 14px; }
.avatar.group { background: #e9ecf3; font-size: 18px !important; }
.conv-body { flex: 1; min-width: 0; }
.conv-top, .conv-bottom { display: flex; align-items: center; gap: 6px; }
.conv-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 11.5px; color: var(--muted); }
.conv-preview { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.has-unread .conv-name, .conv.has-unread .conv-preview { font-weight: 700; color: var(--text); }
.unread { background: var(--brand-red); color: #fff; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.chat-head .avatar { width: 38px; height: 38px; font-size: 14px; }
.chat-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .back { display: none; }
.chat-empty { flex: 1; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 20px; }
.chat-empty.small { padding: 40px 0; }
.msg-list { flex: 1; overflow-y: auto; padding: 16px 18px; background: #f7f8fb; }
.load-more { text-align: center; font-size: 12.5px; padding: 4px 0 10px; }
.day-sep { text-align: center; margin: 14px 0 10px; }
.day-sep span { background: #e6e9f1; color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 10px; }
.msg-sys { text-align: center; font-size: 12.5px; color: var(--muted); margin: 8px 0; }
.msg { display: flex; gap: 8px; margin-top: 10px; }
.msg.grouped { margin-top: 2px; }
.msg-av { width: 28px; flex-shrink: 0; }
.msg-col { max-width: 70%; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine { justify-content: flex-end; }
.msg.mine .msg-col { align-items: flex-end; }
.msg-name { font-size: 12px; color: var(--muted); margin: 0 0 2px 4px; font-weight: 600; }
.msg-row { display: flex; align-items: center; gap: 4px; max-width: 100%; }
.msg.mine .msg-row { flex-direction: row-reverse; }
.bubble { background: #fff; border: 1px solid #e8ebf2; padding: 7px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; min-width: 0; }
/* Tin của mình: nền xanh nhạt, chữ đậm màu (đồng bộ với tin có tệp, dễ đọc như Teams) */
.msg.mine .bubble { background: #e7f3ec; border-color: #cfe5d7; color: #242424; }
.msg.mine .bubble a { color: var(--accent); text-decoration: underline; }
.bubble.is-deleted { background: transparent !important; border: 1px dashed #c9cfdb !important; color: var(--muted) !important; }
.deleted { font-style: italic; }
.msg-img { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; }
.bubble:has(.msg-img) { padding: 4px; background: #fff !important; border-color: #e8ebf2 !important; }
.msg-file { display: inline-block; }
/* Thẻ tệp trong tin nhắn (giống Teams) */
.bubble:has(.fcard) { white-space: normal; padding: 8px; }
.bubble .oc-text + .fcard { margin-top: 6px; }
.bubble:has(.fcard) .msg-cap { margin-top: 0; padding: 0 4px; }
.fcard { background: #fff; color: #242424; border: 1px solid #e0e0e0; border-radius: 6px; width: 300px; max-width: 100%; overflow: hidden; }
.fcard-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.fcard-head .oc-file-ico { width: 24px; height: 28px; font-size: 8px; padding-bottom: 3px; }
.msg.mine .bubble .fcard a.fcard-name, .fcard-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; color: #242424; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard-name:hover { text-decoration: underline !important; }
.fcard-size { font-size: 11.5px; color: #616161; flex-shrink: 0; }
.msg.mine .bubble .fcard a.fcard-btn, .fcard-btn { flex-shrink: 0; width: 26px; height: 26px; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #424242; text-decoration: none; font-size: 15px; }
.fcard-btn:hover { background: #f0f0f0; }
.fcard-prev { display: block; position: relative; height: 170px; border-top: 1px solid #e0e0e0; background: #f5f5f5; overflow: hidden; }
.fcard-prev iframe { width: 100%; height: 420px; border: 0; pointer-events: none; display: block; background: #fff; }
.fcard-prev::after { content: ''; position: absolute; inset: 0; }   /* lớp phủ để bấm mở tệp thay vì thao tác trong khung PDF */
.fcard-prev:hover::after { background: rgba(0, 0, 0, .04); }
.msg-time { font-size: 11px; color: var(--muted); margin: 2px 4px 0; }
/* Tin của mình có tệp: nền sáng để thẻ tệp và lời nhắn dễ đọc */
.msg.mine .bubble:has(.fcard), .msg.mine .bubble:has(.msg-quote) { background: #e7f3ec; border-color: #cfe5d7; color: #242424; }
.msg.mine .bubble:has(.fcard) a:not(.fcard-name):not(.fcard-btn), .msg.mine .bubble:has(.msg-quote) a { color: var(--accent); }
/* Thanh công cụ khi rê chuột: biểu cảm nhanh · trả lời · ⋯ */
.msg-row { position: relative; }
.msg-tools { position: absolute; bottom: calc(100% - 6px); right: 0; z-index: 3; display: none; align-items: center; gap: 1px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 3px 4px; white-space: nowrap; }
.msg:not(.mine) .msg-tools { right: auto; left: 0; }
.msg-row:hover .msg-tools, .msg-tools:focus-within { display: flex; }
.mt-emo { border: 0; background: none; font-size: 18px; width: 32px; height: 30px; border-radius: 6px; cursor: pointer; transition: transform .1s; }
.mt-emo:hover { background: #f3f3f3; transform: scale(1.18); }
.mt-sep { width: 1px; height: 20px; background: #e0e0e0; margin: 0 3px; }
.mt-btn { border: 0; background: none; color: #616161; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.mt-btn:hover { background: #f3f3f3; color: var(--accent); }
/* Biểu cảm dưới tin */
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 2px 0; }
.react { border: 1px solid #e0e0e0; background: #fff; border-radius: 12px; padding: 1px 7px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; line-height: 20px; }
.react span { font-size: 12px; color: #616161; }
.react.on { border-color: var(--accent); background: var(--accent-soft); }
.react.on span { color: var(--accent); font-weight: 600; }
.react:hover { border-color: var(--accent); }
/* Trích dẫn tin được trả lời */
.msg-quote { white-space: normal; border-left: 3px solid var(--accent); background: rgba(0,0,0,.04); border-radius: 4px; padding: 5px 9px; margin: 2px 0 6px; cursor: pointer; max-width: 420px; }
.msg-quote:hover { background: rgba(0,0,0,.07); }
.msg-quote.deleted { cursor: default; font-style: italic; color: #8a8886; }
.mq-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.mq-head span { color: #8a8886; font-size: 11px; }
.mq-text { font-size: 12.5px; color: #424242; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msg-pin { display: inline-flex; vertical-align: -2px; margin-right: 3px; color: #c4314b; }
.msg-pin svg { width: 12px; height: 12px; }
.msg.flash .bubble { animation: msg-flash 2s ease-out; }
@keyframes msg-flash { 0%, 30% { box-shadow: 0 0 0 3px #ffd335; } 100% { box-shadow: 0 0 0 3px transparent; } }
/* Khung "Đang trả lời" trên ô soạn */
.oc-reply { display: flex; align-items: center; gap: 8px; margin: 8px 10px 0; padding: 6px 8px; border-left: 3px solid var(--accent); background: #f5f5f5; border-radius: 4px; }
.oc-reply-ico { color: var(--accent); display: inline-flex; }
.oc-reply-body { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; }
.oc-reply-body span { color: #616161; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Tiêu đề cuộc trò chuyện kiểu Teams: ảnh + tên đậm + thẻ, bên phải các nút */
#chat-head { gap: 10px; padding: 0 12px 0 16px; min-height: 54px; align-items: stretch; background: #fff; }
#chat-head > .avatar, #chat-head > .back { align-self: center; }
#chat-head .avatar { width: 32px; height: 32px; font-size: 12.5px; }
#chat-head .chat-title-wrap { align-self: center; }
#chat-head .chat-title { font-size: 16px; }
.chat-acts { display: flex; align-items: center; gap: 2px; align-self: center; }
.ch-btn { border: 0; background: none; color: #424242; height: 32px; min-width: 32px; padding: 0 6px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: 12.5px; font-weight: 600; }
.ch-btn svg { width: 18px; height: 18px; }
.ch-btn:hover, .ch-btn.on { background: #f0f0f0; color: var(--accent); }
.ch-sep { width: 1px; height: 20px; background: #e0e0e0; margin: 0 4px; }
/* Khung tìm trong cuộc trò chuyện (bên phải) */
.chat-main { position: relative; }
.chat-findpane { position: absolute; top: 54px; right: 0; bottom: 0; width: 340px; max-width: 100%; background: #fff; border-left: 1px solid var(--border); box-shadow: -4px 0 14px rgba(0,0,0,.06); display: flex; flex-direction: column; z-index: 5; }
.chat-main.with-find .msg-list, .chat-main.with-find .oc-composer, .chat-main.with-find .pin-bar { margin-right: 340px; }
.cf-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 16px; font-size: 14px; }
.cf-box { padding: 4px 16px 10px; }
.cf-box input { width: 100%; }
.cf-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.cf-count { font-size: 12px; color: #8a8886; padding: 2px 8px 6px; }
.cf-empty { color: #8a8886; font-size: 13px; padding: 20px 10px; text-align: center; }
.cf-item { width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; background: none; padding: 8px; border-radius: 6px; cursor: pointer; font: inherit; color: inherit; }
.cf-item:hover { background: #f5f5f5; }
.cf-item.on { background: var(--accent-soft); }
.cf-item .avatar { width: 28px; height: 28px; font-size: 11px; flex-shrink: 0; }
.cf-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cf-top { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.cf-top span { color: #8a8886; font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.cf-text { font-size: 13px; color: #424242; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.cf-text mark { background: #fff100; color: inherit; padding: 0 1px; border-radius: 2px; }
@media (max-width: 860px) { .chat-main.with-find .msg-list, .chat-main.with-find .oc-composer, .chat-main.with-find .pin-bar { margin-right: 0; } .ch-people span { display: none; } }
/* ---------- Kênh đơn hàng: thẻ Bài đăng · Đơn hàng ---------- */
.chan-toolbar { align-items: stretch; }
.chan-toolbar .chan-head { align-self: center; }
.chan-tabs { display: flex; gap: 2px; margin-left: 18px; align-self: stretch; }
.chan-tabs button { border: 0; background: none; font: inherit; font-size: 14px; color: #424242; padding: 0 12px; cursor: pointer; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.chan-tabs button:hover { color: var(--accent); }
.chan-tabs button.on { color: #242424; font-weight: 600; border-bottom-color: var(--accent); }
.chan-toolbar .btn.primary { align-self: center; }
.chan-toolbar { flex-wrap: nowrap; }
.chan-toolbar .chan-head { flex-shrink: 0; }
.chan-toolbar .btn.primary { flex-shrink: 0; white-space: nowrap; }
.chan-tabs { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.chan-tabs button { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.chtab-dd { display: inline-flex; padding: 2px; border-radius: 4px; color: #616161; }
.chtab-dd:hover { background: #f0f0f0; color: var(--accent); }
.chtab-dd svg { width: 12px; height: 12px; }
.chan-tabs .chtab-add { padding: 0 8px; color: #616161; }
.chan-tabs .chtab-add svg { width: 14px; height: 14px; }
.ctf-range[hidden] { display: none; }
.ctf-years { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
/* Trang có thẻ Bài đăng: khung bài đăng tự cuộn riêng, chiếm hết phần còn lại (bài mới nhất ở dưới cùng) */
#page:has(> .posts-wrap) { display: flex; flex-direction: column; padding-bottom: 0; overflow: hidden; }
.posts-wrap { flex: 1; min-height: 0; overflow-y: auto; background: #f5f5f5; margin: 0 -22px; padding: 16px 22px 24px; border-top: 1px solid #e6e6e6; }
.posts-inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.posts-older { align-self: center; }
.posts-empty { text-align: center; color: #616161; padding: 60px 20px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.post-card { background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); overflow: hidden; }
.pc-ref { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; flex-wrap: wrap; }
.pc-ref .tt-ref { margin-left: 0; }
.pc-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pc-more { border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; padding: 2px 16px 4px 58px; text-align: left; }
.pc-more:hover { text-decoration: underline; }
.pc-msgs { padding: 0 0 4px; }
.pc-msg { display: flex; gap: 10px; padding: 8px 16px; }
.pc-msg:hover { background: #fafafa; }
.pc-msg { position: relative; }
.msg-edited { color: #8a8886; font-style: italic; }
.pc-files .fcard, .oc-bubble .fcard { max-width: 340px; }
.pc-msg.flash { animation: oc-flash 2.4s ease-out; }
/* Thanh biểu cảm / trả lời / ⋯ khi rê chuột lên tin trong đơn (bài đăng + cửa sổ đơn) */
.oc-mtools { bottom: auto; top: -16px; right: 12px; left: auto !important; }
.pc-msg:hover > .oc-mtools, .oc-bubble:hover > .oc-mtools, .oc-mtools:focus-within { display: flex; }
.pc-msg:first-child > .oc-mtools { top: -4px; }
.oc-bubble .oc-mtools { top: -26px; left: 0 !important; right: auto; }
.oc-msg.mine .oc-bubble .oc-mtools { left: auto !important; right: 0; }
.oc-list > .oc-msg:first-child .oc-bubble .oc-mtools { top: auto; bottom: -30px; }
.oc-msg .msg-reacts { margin-top: 3px; }
.oc-bubble .msg-quote { margin: 0; align-self: stretch; }
.pc-msg .avatar { width: 32px; height: 32px; font-size: 11.5px; flex-shrink: 0; }
.pc-col { flex: 1; min-width: 0; }
.pc-meta { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: #616161; }
.pc-meta b { color: #242424; font-weight: 600; }
.pc-meta i { font-size: 11.5px; }
.pc-col .oc-text { font-size: 14px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.pc-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pc-file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #e0e0e0; border-radius: 6px; padding: 8px 12px; color: #242424; text-decoration: none; max-width: 300px; font-size: 13px; font-weight: 600; }
.pc-file span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-file:hover { border-color: var(--accent); }
.pc-img img { max-width: 280px; max-height: 200px; border-radius: 6px; display: block; border: 1px solid #e6e6e6; }
.pc-reply { border-top: 1px solid #f0f0f0; }
.pc-reply-btn { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 10px 16px; cursor: pointer; font: inherit; font-size: 13px; color: #616161; text-align: left; }
.pc-reply-btn:hover { color: var(--accent); background: #fafafa; }
.pc-reply-btn .avatar { width: 24px; height: 24px; font-size: 9px; }
.pc-reply.open { padding: 4px 6px 2px; }
.pc-reply.open .oc-composer { margin: 6px; }

/* ---------- Thông tin nhóm: ảnh nhóm + tên (không tràn khung) ---------- */
.gf-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.gf-av { position: relative; flex-shrink: 0; }
.gf-av .avatar { width: 64px; height: 64px; font-size: 28px !important; }
.gf-av-edit { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 1px solid #d1d1d1; display: flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.gf-av-edit:hover { border-color: var(--accent); }
.gf-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.gf-name .field { width: 100%; }
.gf-name .gf-name-row { display: flex !important; flex-direction: row; align-items: center; gap: 8px; width: 100%; margin: 0; font-size: inherit; color: inherit; font-weight: 400; }
.gf-name-row input { flex: 1; min-width: 0; }
.gf-name-row .btn { flex-shrink: 0; white-space: nowrap; }
.avatar.group.has-img { padding: 0; overflow: hidden; background: #e9ecf3; }
.avatar.group.has-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
/* @Mọi người */
.mention.all, .oc-text .mention.all, .oc-input .mention.all { color: #d13438; font-weight: 600; }
.avatar.mention-all { background: #d13438; font-size: 14px; }
/* Nhãn độ ưu tiên: trên ô soạn và trong tin */
.oc-prio { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 10px 0; padding: 4px 6px 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.oc-prio.important { background: #fde7e9; color: #c4314b; }
.oc-prio.urgent { background: #c4314b; color: #fff; }
.oc-prio.urgent .oc-fbtn { color: #fff; }
.msg-prio { font-size: 11.5px; font-weight: 800; color: #c4314b; letter-spacing: .3px; margin-bottom: 3px; }
.bubble.p-important, .bubble.p-urgent { border-left: 3px solid #c4314b !important; }
.bubble.p-urgent { background: #fff4f5 !important; }
/* Bình chọn */
.bubble.k-poll, .bubble.k-praise { white-space: normal; background: #fff !important; border-color: #e0e0e0 !important; color: #242424 !important; padding: 10px 12px; }
.poll { width: 340px; max-width: 100%; }
.poll-h { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.poll-ico { font-size: 16px; }
.poll-sub { font-size: 11.5px; color: #8a8886; margin: 2px 0 8px 24px; }
.poll-opt { position: relative; width: 100%; display: flex; align-items: center; gap: 8px; border: 1px solid #e0e0e0; background: #fff; border-radius: 6px; padding: 7px 10px; margin-top: 6px; cursor: pointer; font: inherit; font-size: 13px; text-align: left; overflow: hidden; }
.poll-opt:hover:not(:disabled) { border-color: var(--accent); }
.poll-opt:disabled { cursor: default; }
.poll-opt.on { border-color: var(--accent); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width .25s; z-index: 0; }
.poll-mark, .poll-txt, .poll-avs, .poll-n { position: relative; z-index: 1; }
.poll-mark { color: var(--accent); width: 16px; }
.poll-txt { flex: 1; min-width: 0; }
.poll-avs { display: inline-flex; }
.poll-avs .avatar { width: 20px; height: 20px; font-size: 8px; margin-left: -5px; box-shadow: 0 0 0 2px #fff; }
.poll-n { font-weight: 700; min-width: 16px; text-align: right; }
.poll-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: #616161; }
.poll.closed .poll-opt { opacity: .85; }
.pf-opt { display: flex; gap: 6px; margin-bottom: 6px; }
.pf-opt input { flex: 1; }
/* Khen ngợi */
.praise { width: 340px; max-width: 100%; border-radius: 6px; overflow: hidden; border-top: 4px solid var(--c); }
.praise-top { display: flex; gap: 12px; align-items: center; padding: 10px 2px 6px; }
.praise-emo { width: 52px; height: 52px; border-radius: 50%; background: color-mix(in srgb, var(--c) 16%, #fff); display: flex; align-items: center; justify-content: center; font-size: 28px; flex-shrink: 0; }
.praise-label { font-size: 16px; font-weight: 800; color: var(--c); }
.praise-who { font-size: 12.5px; color: #424242; }
.praise-note { font-size: 13.5px; padding: 6px 2px; white-space: pre-wrap; }
.praise-avs { display: flex; gap: 4px; padding: 4px 2px 2px; }
.praise-avs .avatar { width: 24px; height: 24px; font-size: 9px; }
.praise-badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pb { border: 1px solid #e0e0e0; background: #fff; border-radius: 8px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; font-size: 11.5px; color: #424242; }
.pb span { font-size: 22px; }
.pb:hover { border-color: var(--c); }
.pb.on { border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); font-weight: 600; }
/* Lên lịch tin nhắn */
.sf-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.sch-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.sch-main { flex: 1; min-width: 0; }
.sch-when { font-size: 12.5px; color: #616161; }
.sch-p { color: #c4314b; }
.sch-body { font-size: 13.5px; margin-top: 2px; word-break: break-word; }

/* ---------- Cuộc gọi (bố cục như Teams) ---------- */
.ch-drop { min-width: 20px; padding: 0 2px; margin-left: -4px; }
.ch-join { border: 0; background: #13a10e; color: #fff; height: 30px; padding: 0 12px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ch-join:hover { background: #0e8a0a; }
.ch-join svg { width: 16px; height: 16px; }
.ch-incall { color: #13a10e; }
.call-ui { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; color: #242424;
  background: linear-gradient(135deg, #e3f4ec 0%, #eef0f8 45%, #ece6f4 100%); }
.call-bar { display: flex; align-items: center; gap: 12px; padding: 6px 14px; background: #fff; border-bottom: 1px solid #e0e0e0; min-height: 56px; }
.call-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; }
.call-title #call-timer { font-variant-numeric: tabular-nums; font-size: 13.5px; color: #424242; white-space: nowrap; }
.call-title b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-ctrls { display: flex; align-items: center; gap: 2px; }
.cbar-btn { border: 0; background: none; color: #424242; min-width: 56px; height: 48px; border-radius: 6px; cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-size: 11.5px; position: relative; padding: 0 6px; }
.cbar-btn svg { width: 20px; height: 20px; }
.cbar-btn:hover { background: #f3f3f3; }
.cbar-btn.on-mic { color: var(--accent); }
.cbar-btn.off { color: #c4314b; }
.cbar-btn.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.cbar-btn sup { position: absolute; top: 6px; right: 10px; font-size: 10px; font-weight: 600; }
.cbar-sep { width: 1px; height: 30px; background: #e0e0e0; margin: 0 6px; }
.cbar-btn.hang { color: #c4314b; flex: 0 0 auto; margin-left: auto; }
.cbar-btn.hang:hover { background: #fde7e9; }
.call-body { flex: 1; min-height: 0; display: flex; }
.call-grid { flex: 1; min-width: 0; display: grid; gap: 8px; padding: 10px; grid-template-columns: 1fr; grid-auto-rows: 1fr; position: relative; }
.call-grid[data-layout="grid"][data-n="2"], .call-grid[data-layout="grid"][data-n="3"], .call-grid[data-layout="grid"][data-n="4"] { grid-template-columns: 1fr 1fr; }
.call-grid[data-layout="grid"][data-n="5"], .call-grid[data-layout="grid"][data-n="6"], .call-grid[data-layout="grid"][data-n="7"],
.call-grid[data-layout="grid"][data-n="8"], .call-grid[data-layout="grid"][data-n="9"] { grid-template-columns: repeat(3, 1fr); }
/* Gọi 1-1: người kia chiếm sân khấu, ảnh mình nhỏ ở góc dưới phải */
.call-grid[data-layout="pip"] .call-tile.pip { position: absolute; right: 18px; bottom: 18px; width: 210px; height: 128px; z-index: 2; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
/* Ghim / chia sẻ màn hình: ô nổi bật to, các ô khác thành dải nhỏ bên phải */
.call-grid[data-layout="spot"] { grid-template-columns: 1fr 200px; grid-template-rows: 1fr; }
.call-grid[data-layout="spot"] > .call-tile.main { grid-column: 1; grid-row: 1; }
.call-grid[data-layout="spot"] > .call-strip { grid-column: 2; grid-row: 1; }
.call-strip { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.call-strip .call-tile { flex: 0 0 120px; }
.call-strip .ct-av .avatar { width: 52px; height: 52px; font-size: 18px; }
.call-grid[data-layout="wait"] { display: flex; align-items: center; justify-content: center; }
.call-grid[data-layout="wait"] .call-tile.is-me { position: absolute; right: 18px; bottom: 18px; width: 210px; height: 128px; }
.call-wait { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.call-wait .avatar { width: 150px; height: 150px; font-size: 54px; box-shadow: 0 6px 20px rgba(0,0,0,.08); animation: call-pulse 1.6s ease-in-out infinite; }
.call-wait b { font-size: 18px; }
.call-wait span { display: inline-flex; align-items: center; gap: 6px; color: #424242; font-size: 14px; }
.call-wait span svg { width: 16px; height: 16px; }
@keyframes call-pulse { 50% { opacity: .55; } }
.call-tile { position: relative; background: rgba(255,255,255,.55); border: 1px solid rgba(0,0,0,.06); border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 0; }
.call-tile.has-video { background: #1b1b1b; }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.call-tile.screen video, .call-tile.main video { object-fit: contain; }
.call-tile.has-video video { opacity: 1; }
.call-tile.mirror video { transform: scaleX(-1); }
.call-tile.has-video .ct-av { display: none; }
.ct-av { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ct-av .avatar { width: 120px; height: 120px; font-size: 44px; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.call-tile.pip .ct-av .avatar, .call-grid[data-layout="wait"] .ct-av .avatar { width: 56px; height: 56px; font-size: 20px; }
.ct-status { font-size: 13px; color: #616161; }
.ct-name { position: absolute; left: 8px; bottom: 8px; background: rgba(36,36,36,.72); color: #fff; padding: 3px 9px; border-radius: 4px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 50px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ct-name i { font-style: normal; color: #d6d6d6; }
.ct-mute { display: inline-flex; color: #ff9a9a; }
.ct-mute svg { width: 13px; height: 13px; }
.ct-pin { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 6px; background: rgba(36,36,36,.65); color: #fff; cursor: pointer; display: none; align-items: center; justify-content: center; }
.call-tile:hover .ct-pin, .call-tile.pinned .ct-pin { display: inline-flex; }
.call-tile.pinned .ct-pin { background: var(--accent); }
.call-tile.main { border-color: rgba(0,0,0,.08); }
/* Nút ▾ cạnh Micrô / Camera và menu cài đặt thiết bị */
.cbar-pair { display: inline-flex; align-items: stretch; }
.cbar-drop { border: 0; background: none; color: #616161; width: 18px; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; margin-left: -4px; }
.cbar-drop:hover, .cbar-drop.active { background: #f0f0f0; color: var(--accent); }
.cbar-btn sup.unread-dot { background: #c4314b; color: #fff; border-radius: 8px; padding: 0 4px; line-height: 14px; top: 3px; right: 6px; }
.call-pop { position: fixed; z-index: 960; width: 330px; max-height: calc(100vh - 80px); overflow-y: auto; background: #fff; color: #242424; border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.22); padding: 12px 14px; font-size: 13px; }
.call-pop hr { border: 0; border-top: 1px solid #e8e8e8; margin: 10px 0; }
.cp-sec { font-size: 12px; color: #616161; margin: 2px 0 6px; }
.cp-note { color: #8a8886; font-size: 12.5px; padding: 2px 0 4px; }
.cp-radio { display: flex; align-items: flex-start; gap: 8px; padding: 5px 4px; border-radius: 4px; cursor: pointer; }
.cp-radio:hover { background: #f5f5f5; }
.cp-radio input { margin-top: 2px; accent-color: var(--accent); }
.cp-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.cp-row.dis { opacity: .4; pointer-events: none; }
.cp-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.cp-ico { display: inline-flex; color: #616161; width: 18px; justify-content: center; }
.cp-meter { flex: 1; display: flex; gap: 3px; height: 14px; align-items: stretch; }
.cp-meter i { flex: 1; background: #e3e3e3; border-radius: 2px; }
.cp-meter i.on { background: var(--accent); }
.cp-switch { display: flex; align-items: center; gap: 10px; padding: 7px 4px; cursor: pointer; }
.cp-switch > span { flex: 1; display: flex; flex-direction: column; }
.cp-switch small { color: #8a8886; font-size: 11.5px; }
.cp-switch input { display: none; }
.cp-switch b { width: 36px; height: 20px; border-radius: 10px; background: #c8c8c8; position: relative; flex-shrink: 0; transition: background .15s; }
.cp-switch b::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.cp-switch input:checked + b { background: var(--accent); }
.cp-switch input:checked + b::after { left: 19px; }
.cp-prev { position: relative; height: 160px; background: #1b1b1b; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.cp-prev video { width: 100%; height: 100%; object-fit: cover; }
.cp-prev.mirror video { transform: scaleX(-1); }
.cp-prev-off[hidden] { display: none; }
.cp-prev-off { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #c8c8c8; font-size: 12.5px; }
/* Khung Chat trong cuộc gọi */
.call-side .oc-composer { margin: 8px 10px 10px; }
.cc-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 12px; background: #fafafa; }
.cc-sys { text-align: center; font-size: 11.5px; color: #8a8886; margin: 8px 0; }
.cc-msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: 8px; }
.cc-msg.grouped { margin-top: 2px; }
.cc-msg.mine { align-items: flex-end; }
.cc-meta { display: flex; gap: 6px; font-size: 11.5px; color: #8a8886; margin: 0 2px 2px; }
.cc-meta b { color: #424242; font-weight: 600; }
.cc-bubble { background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; padding: 6px 10px; max-width: 92%; font-size: 13px; word-break: break-word; }
.cc-msg.mine .cc-bubble { background: #e7f3ec; border-color: #cfe5d7; }
.cc-img { max-width: 220px; max-height: 160px; border-radius: 6px; display: block; }
.cc-file { color: var(--accent); }
/* Khung "Người dự" */
.call-side { display: none; }
.call-ui.with-side .call-side { display: flex; flex-direction: column; width: 340px; background: #fff; border-left: 1px solid #e0e0e0; }
.cs-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; font-size: 15px; }
.call-ic { border: 0; background: none; color: #424242; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.call-ic:hover { background: #f3f3f3; }
.cs-q { margin: 0 14px 8px; width: calc(100% - 28px); }
.cs-list { flex: 1; overflow-y: auto; padding: 0 6px 12px; }
.cs-sec { font-size: 12px; color: #616161; padding: 10px 12px 6px; }
.cs-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 6px; }
.cs-row:hover { background: #f5f5f5; }
.cs-row .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.cs-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.cs-mic { color: #424242; display: inline-flex; } .cs-mic.off { color: #c4314b; }
.cs-mic svg { width: 16px; height: 16px; }
.cs-inv { border: 1px solid #d1d1d1; background: #fff; border-radius: 4px; font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.cs-inv:hover { border-color: var(--accent); color: var(--accent); }
.cs-inv.ringing { color: #13a10e; border-color: #13a10e; animation: call-pulse 1.6s ease-in-out infinite; }
.cs-note { font-size: 12.5px; color: #616161; padding: 10px 12px; }
/* Thu nhỏ: khung nổi ở góc để vừa gọi vừa nhắn tin */
.call-ui.mini { inset: auto 18px 18px auto; width: 360px; height: 270px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.3); overflow: hidden; }
.call-ui.mini .call-bar { flex-wrap: wrap; padding: 4px 8px; gap: 4px; min-height: 0; }
.call-ui.mini .call-title { flex-basis: 100%; }
.call-ui.mini .cbar-btn { min-width: 38px; height: 36px; }
.call-ui.mini .cbar-drop, .call-ui.mini .cbar-btn span, .call-ui.mini .cbar-sep, .call-ui.mini #cb-chat, .call-ui.mini #cb-people { display: none; }
.call-ui.mini .cbar-btn.hang { margin-left: 0; }
.call-ui.mini .call-grid { padding: 4px; gap: 4px; }
.call-ui.mini .call-grid[data-layout="pip"] .call-tile.pip, .call-ui.mini .call-grid[data-layout="wait"] .call-tile.is-me { width: 96px; height: 60px; right: 8px; bottom: 8px; }
.call-ui.mini .call-grid[data-layout="spot"] { grid-template-columns: 1fr 80px; }
.call-ui.mini .call-strip .call-tile { flex-basis: 52px; }
.call-ui.mini .ct-av .avatar, .call-ui.mini .call-wait .avatar { width: 52px; height: 52px; font-size: 18px; }
.call-ui.mini .ct-name { font-size: 11px; }
/* Chuông cuộc gọi đến */
#call-rings { position: fixed; right: 18px; bottom: 18px; z-index: 950; display: flex; flex-direction: column; gap: 10px; }
.call-ring { width: 330px; background: #fff; color: #242424; border-radius: 10px; box-shadow: 0 10px 32px rgba(0,0,0,.25); padding: 16px; animation: ring-in .25s ease-out; border-top: 4px solid #13a10e; }
@keyframes ring-in { from { transform: translateY(20px); opacity: 0; } }
.cr-top { display: flex; align-items: center; gap: 12px; }
.cr-top .avatar { width: 48px; height: 48px; font-size: 16px; animation: call-pulse 1.4s ease-in-out infinite; }
.cr-txt { display: flex; flex-direction: column; min-width: 0; }
.cr-txt b { font-size: 15px; }
.cr-txt span { font-size: 12.5px; color: #616161; }
.cr-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.cr-btn { border: 0; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.cr-btn.ok { background: #13a10e; } .cr-btn.ok:hover { background: #0e8a0a; }
.cr-btn.no { background: #c4314b; } .cr-btn.no:hover { background: #a4262c; }
.cr-lbl { display: none; }
/* Điện thoại: ô của mình ở góc theo tỉ lệ camera thật (lớp portrait do calls.js gắn), ô người kia hiện trọn khung hình */
@media (max-width: 600px) {
  .call-grid[data-layout="pip"] .call-tile.pip, .call-grid[data-layout="wait"] .call-tile.is-me { width: 160px; height: 108px; right: 12px; bottom: 12px; border-radius: 12px; }
  .call-grid[data-layout="pip"] .call-tile.pip.portrait, .call-grid[data-layout="wait"] .call-tile.is-me.portrait { width: 108px; height: 160px; }
  .call-grid[data-layout="pip"] .call-tile.main video { object-fit: contain; }
}
.cr-btn[data-ans="video"] { order: 1; } .cr-btn[data-ans="audio"] { order: 2; } .cr-btn.no { order: 3; }   /* máy tính: Video · Nghe · Từ chối */
/* Điện thoại: cuộc gọi đến phủ kín màn hình như cuộc gọi điện thoại (ảnh lớn ở giữa, nút to có nhãn ở dưới) */
@media (max-width: 600px) {
  #call-rings { inset: 0; right: 0; bottom: 0; gap: 0; z-index: 1200; pointer-events: none; }
  #call-rings:empty { display: none; }   /* đã nghe / từ chối: lớp phủ rỗng không được chặn các nút trong cuộc gọi */
  #call-rings .call-ring { pointer-events: auto; }
  #call-rings .call-ring { position: absolute; inset: 0; width: auto; border: 0; border-radius: 0; box-shadow: none; animation: none;
    display: flex; flex-direction: column; justify-content: space-between; align-items: center;
    padding: calc(70px + env(safe-area-inset-top)) 24px calc(56px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #1f2a3a 0%, #121820 100%); color: #fff; }
  #call-rings .call-ring:not(:last-child) { display: none; }   /* nhiều cuộc gọi cùng lúc: hiện cuộc mới nhất */
  #call-rings .cr-top { flex-direction: column; gap: 18px; text-align: center; }
  #call-rings .cr-top .avatar { width: 132px; height: 132px; font-size: 44px; box-shadow: 0 0 0 10px rgba(255,255,255,.08), 0 0 0 22px rgba(255,255,255,.04); }
  #call-rings .cr-txt { align-items: center; gap: 8px; }
  #call-rings .cr-txt b { font-size: 28px; font-weight: 600; color: #fff; }
  #call-rings .cr-txt span { font-size: 16px; color: rgba(255,255,255,.75); }
  #call-rings .cr-btns { width: 100%; max-width: 360px; justify-content: space-around; gap: 0; margin: 0; }
  #call-rings .cr-btn { position: relative; width: 72px; height: 72px; margin-bottom: 26px; order: 0; }   /* Từ chối · Nghe · Video */
  #call-rings .cr-btn svg { width: 30px; height: 30px; }
  #call-rings .cr-lbl { display: block; position: absolute; top: calc(100% + 9px); left: 50%; transform: translateX(-50%); white-space: nowrap;
    font-style: normal; font-size: 14px; color: rgba(255,255,255,.85); }
}
@media (max-width: 760px) {
  .cbar-btn span { display: none; } .cbar-btn { min-width: 40px; }
  .call-ui.with-side .call-side { position: absolute; inset: 56px 0 0 auto; width: 100%; z-index: 3; }
  .call-grid[data-layout="spot"] { grid-template-columns: 1fr; grid-template-rows: 1fr 110px; }
  .call-grid[data-layout="spot"] > .call-strip { grid-column: 1; grid-row: 2; }
  .call-strip { flex-direction: row; overflow-x: auto; } .call-strip .call-tile { flex: 0 0 150px; }
  .call-ui.mini { width: calc(100% - 24px); right: 12px; }
}
/* Cửa sổ xem trước tệp */
.fv { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 20, 20, .86); display: flex; flex-direction: column; }
.fv-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; color: #242424; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.fv-head .oc-file-ico { flex-shrink: 0; }
.fv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fv-title b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-title span { font-size: 12px; color: #616161; }
.fv-pos { font-size: 12.5px; color: #616161; white-space: nowrap; }
.fv-btn { border: 0; background: none; color: #424242; width: 34px; height: 34px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; text-decoration: none; }
.fv-btn:hover { background: #f0f0f0; color: var(--accent); }
.fv-btn svg { width: 18px; height: 18px; }
.fv-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 20px 70px; overflow: auto; }
.fv-img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 4px 24px rgba(0,0,0,.4); background: #fff; }
.fv-frame { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.fv-media { max-width: 100%; max-height: 100%; background: #000; }
.fv-msg { color: #fff; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; font-size: 14px; }
.fv-msg.small { color: #616161; font-size: 12.5px; padding: 8px; }
.fv-text { width: min(1000px, 100%); height: 100%; margin: 0; overflow: auto; background: #fff; color: #242424; padding: 16px 20px; border-radius: 4px; font: 13px/1.5 Consolas, 'Courier New', monospace; white-space: pre-wrap; word-break: break-word; }
.fv-table-wrap { width: min(1200px, 100%); height: 100%; overflow: auto; background: #fff; border-radius: 4px; }
.fv-table { border-collapse: collapse; font-size: 13px; color: #242424; }
.fv-table th, .fv-table td { border: 1px solid #e0e0e0; padding: 4px 8px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.fv-table th { background: #f3f3f3; position: sticky; top: 0; font-weight: 600; }
.fv-table tr:nth-child(even) td { background: #fafafa; }
.fv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 6px; background: rgba(255,255,255,.15); color: #fff; font-size: 34px; cursor: pointer; }
.fv-nav:hover { background: rgba(255,255,255,.3); }
.fv-nav.prev { left: 12px; } .fv-nav.next { right: 12px; }
@media (max-width: 700px) { .fv-body { padding: 10px; } .fv-nav { display: none; } }
.fcard-head button.fcard-btn { border: 0; background: none; cursor: pointer; }
.fcard-head button.fcard-btn svg { width: 16px; height: 16px; }
.fcard-name { cursor: pointer; }
/* Thẻ Trò chuyện · Đã chia sẻ trong tiêu đề cuộc trò chuyện */
.chat-title-wrap { min-width: 0; flex-shrink: 1; }
.chat-title-wrap .chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-tabs { display: flex; gap: 2px; margin-left: 14px; align-self: stretch; align-items: stretch; }
.chat-tabs button { border: 0; background: none; font: inherit; font-size: 13.5px; color: #424242; padding: 0 10px; cursor: pointer; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.chat-tabs button:hover { color: var(--accent); }
.chat-tabs button.on { color: #242424; font-weight: 600; border-bottom-color: var(--accent); }
.shared-view { display: none; }
.chat-main.tab-shared .shared-view { display: flex; flex-direction: column; flex: 1; min-height: 0; background: #fff; }
.chat-main.tab-shared .msg-list, .chat-main.tab-shared .oc-composer, .chat-main.tab-shared .pin-bar { display: none !important; }
.sh-bar { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sh-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #d1d1d1; background: #fff; border-radius: 16px; padding: 4px 13px; font: inherit; font-size: 13px; cursor: pointer; color: #424242; }
.sh-chip svg { width: 15px; height: 15px; }
.sh-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.sh-bar .sh-q { width: 200px; flex: 0 0 200px; padding: 5px 9px; font-size: 13px; }
.sh-bar .sh-up { flex: 0 0 auto; }
.sh-up { cursor: pointer; }
.sh-list { flex: 1; overflow: auto; padding: 0 18px 18px; }
.sh-table { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
.sh-table th:nth-child(1) { width: 46px; } .sh-table th:nth-child(3) { width: 130px; } .sh-table th:nth-child(4) { width: 190px; } .sh-table th:nth-child(5) { width: 40px; }
.sh-table td:nth-child(4) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-table th { text-align: left; font-weight: 600; font-size: 12.5px; color: #424242; padding: 10px 8px; border-bottom: 1px solid #e0e0e0; position: sticky; top: 0; background: #fff; }
.sh-table td { padding: 9px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.sh-table tr:hover td { background: #fafafa; }
.sh-table tr:hover .sh-more { display: inline-flex; }
.sh-name { min-width: 0; }
.sh-name a { display: block; color: #242424; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-name a:hover { text-decoration: underline; color: var(--accent); }
.sh-name small { display: block; color: #8a8886; font-size: 11.5px; }
.sh-thumb { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; display: block; }
.sh-link-ico { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border: 1px solid #e0e0e0; border-radius: 4px; color: #616161; }
.sh-empty { text-align: center; color: #8a8886; padding: 50px 20px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
@media (max-width: 700px) { .sh-table th:nth-child(4), .sh-table td:nth-child(4) { display: none; } .chat-tabs { margin-left: 6px; } .chat-tabs button { padding: 0 6px; } }
/* Thanh tin đã ghim dưới tiêu đề cuộc trò chuyện */
.pin-bar { display: flex; align-items: center; gap: 10px; padding: 7px 18px; border-bottom: 1px solid var(--border); background: #fff; font-size: 13px; box-shadow: 0 2px 4px rgba(0,0,0,.04); }
.pin-bar[hidden] { display: none; }
.pin-ico { color: #616161; display: inline-flex; }
.pin-ico svg { width: 15px; height: 15px; }
.pin-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit; padding: 2px 0; }
.pin-main b { font-weight: 600; white-space: nowrap; color: #424242; }
.pin-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pin-main:hover .pin-text { text-decoration: underline; }
.pin-count, .pin-date { color: #8a8886; font-size: 12px; white-space: nowrap; }
.pin-bar .pin-more { display: inline-flex; }
/* Vạch "Tin nhắn mới" khi mở cuộc trò chuyện tại tin chưa đọc đầu tiên */
.unread-sep { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; color: var(--brand-red); font-size: 12px; font-weight: 600; }
.unread-sep::before, .unread-sep::after { content: ''; flex: 1; height: 1px; background: var(--brand-red); opacity: .55; }
/* Bộ lọc nhanh trong danh sách trò chuyện */
.conv-chips { padding: 0; gap: 5px; flex-wrap: nowrap; }
/* Đầu danh sách Trò chuyện kiểu Teams: tiêu đề + ⋯ · tìm · soạn mới ▾ */
.chat-head { justify-content: flex-start; gap: 2px; }
.chat-head .spacer { flex: 1; }
.chat-head .icon-btn.small { display: inline-flex; align-items: center; justify-content: center; }
.chat-head .icon-btn.small svg { width: 17px; height: 17px; }
.chat-head .icon-btn.on { background: var(--accent-soft); color: var(--accent); }
.chat-head .chat-new { width: auto; padding: 0 5px 0 7px; gap: 1px; }
.chev-down { font-size: 10px; opacity: .75; }
.chat-side-head.empty { display: none; }
/* Hàng lọc (Chưa đọc · Chat riêng · Nhóm) nằm giữa 2 đường kẻ */
.pane .chat-side-head { padding: 9px 12px; justify-content: center; }
/* Phân mục trong danh sách trò chuyện */
.cs { padding-bottom: 2px; }
.cs-head { display: flex; align-items: center; padding: 6px 8px 2px 6px; position: sticky; top: 0; background: #f5f5f5; z-index: 1; }
.cs-head:hover .tree-more, .cs-head .tree-more:focus { display: inline-flex; }
.cs-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: #424242; padding: 4px 4px; border-radius: 4px; text-align: left; }
.cs-toggle:hover { background: rgba(0,0,0,.04); }
.cs-chev { display: inline-block; width: 12px; text-align: center; transform: rotate(90deg); transition: transform .15s; color: #616161; }
.cs.collapsed .cs-chev { transform: none; }
.cs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-unread { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; line-height: 17px; }
.cs-empty { padding: 6px 12px 8px 30px; font-size: 12.5px; color: #8a8886; }
.cs.drop-over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: 6px; }
.conv.dragging { opacity: .45; }
.conv-chips .chip { padding: 3px 9px; font-size: 12px; white-space: nowrap; }
.conv.no-preview { padding-top: 8px; padding-bottom: 8px; }
.conv.no-preview .avatar { width: 32px; height: 32px; font-size: 12.5px; }
/* Mật độ tin nhắn: Gọn (giống chế độ Gọn của Teams — không bong bóng, dòng sát nhau) */
body.msg-compact .msg { margin-top: 4px; }
body.msg-compact .msg.grouped { margin-top: 0; }
body.msg-compact .msg-av { width: 22px; }
body.msg-compact .msg-av .avatar { width: 22px; height: 22px; font-size: 9.5px; }
body.msg-compact .msg-col { max-width: 85%; }
body.msg-compact .bubble { padding: 2px 9px; border-radius: 8px; font-size: 13.5px; }
body.msg-compact .msg-time { display: none; }
body.msg-compact .msg-name { margin-bottom: 0; }
body.msg-compact .day-sep { margin: 8px 0 4px; }
/* Thanh ứng dụng: ẩn tên dưới biểu tượng */
body.no-rail-labels .rail-label { display: none; }
body.no-rail-labels .rail-btn { padding: 11px 0; }
/* Cài đặt → Chung */
.set-link { display: inline-block; margin-top: 6px; font-size: 13px; }
.set-check.disabled small { color: #a0a0a0; }
.kbd-list { padding: 4px 18px 18px; max-height: 70vh; overflow-y: auto; }
.kbd-group { font-weight: 700; font-size: 13px; margin: 14px 0 6px; }
.kbd-row { display: flex; gap: 16px; padding: 6px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; align-items: center; }
.kbd-row > span:first-child { width: 190px; flex-shrink: 0; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid #d1d1d1; border-bottom-width: 2px; border-radius: 4px; background: #fafafa; font: 12px/1.5 "Segoe UI", sans-serif; text-align: center; color: #242424; }
/* Chế độ tiết kiệm: tắt hiệu ứng chuyển động */
body.saver *, body.saver *::before, body.saver *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
/* Danh sách nút chọn tròn */
.set-radios { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.set-radio { display: flex; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; font-size: 13.5px; }
.set-radio input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }
.composer textarea { min-height: 40px; max-height: 160px; resize: none; padding: 9px 12px; }
.composer .attach { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.composer .btn { height: 40px; }
.picker { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; }
.picker-search { margin-top: 2px; }
.pick { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #f3f4f8; cursor: pointer; width: 100%; }
.pick[hidden] { display: none; }
.pick:hover { background: #f7f8fc; }
.pick-btn { border: 0; border-bottom: 1px solid #f3f4f8; background: none; text-align: left; font: inherit; }

/* Đơn hàng */
.opt { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; white-space: nowrap; border: 1px solid transparent; line-height: 1.5; }
.c-gray { background: #eceef3; color: #4a5263; }
.c-blue { background: #dbe6ff; color: #1f4fc4; }
.c-green { background: #d9f2df; color: #1d7a3d; }
.c-red { background: #fddede; color: #b3261e; }
.c-pink { background: #fbe0ee; color: #a8336d; }
.c-yellow { background: #fff1c2; color: #8a5a00; }
.c-purple { background: #ece1fb; color: #6b37b8; }
.c-orange { background: #ffe4cc; color: #a64b00; }
.c-teal { background: #d4f1f1; color: #0f6e72; }
.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice .opt { cursor: pointer; opacity: .45; font: inherit; font-size: 13px; }
.choice .opt:hover { opacity: .8; }
.choice .opt.on { opacity: 1; border-color: currentColor; font-weight: 600; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.table-scroll { overflow-x: auto; }
table.orders td, table.orders th { white-space: nowrap; }
table.orders td .opt { margin: 1px 0; }
/* Cửa sổ đơn hàng cao vừa màn hình: chỉ phần chi tiết bên trái cuộn, khung trò chuyện bên phải đứng yên (giống Teams) */
.modal.wide.order-modal { width: 1320px; height: calc(100vh / var(--zoom, 1) - 80px); display: flex; flex-direction: column; overflow: hidden; }
.order-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 400px; flex: 1; min-height: 0; }
.order-wrap.no-side, .order-wrap.hide-side { grid-template-columns: 1fr; }
.order-wrap.hide-side > .order-side { display: none; }
.order-main { padding: 14px 22px 18px; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
/* Thanh nút trên cùng cửa sổ đơn: trải hết chiều ngang, bao cả khung trò chuyện */
.order-modal > .order-top { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 18px; border-bottom: 1px solid #e0e0e0; background: #fff; border-radius: 14px 14px 0 0; flex-shrink: 0; min-height: 48px; }
.order-top .o-sidebtn { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.order-top .o-sidebtn.on { background: var(--accent-soft); color: var(--accent); }
.order-top .o-sidebtn sup { position: absolute; top: 2px; right: 0; font-size: 9.5px; font-weight: 700; }
.o-top-sep { width: 1px; height: 22px; background: #e0e0e0; margin: 0 2px; }
.order-banner { background: #1f4e79; color: #fff; border-radius: 10px; padding: 12px 18px; display: flex; align-items: center; gap: 14px; }
.order-banner-icon { font-size: 30px; }
.order-banner-sub { font-size: 12px; opacity: .85; }
.order-banner-no { font-size: 21px; font-weight: 700; }
.order-section { border-bottom: 1px solid var(--border); padding: 14px 0 6px; }
.order-section-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; color: #1d2433; }
.order-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 22px; }
.order-field { padding: 4px 0 12px; min-width: 0; }
.order-field.wide { grid-column: span 1; }
.order-label { font-size: 12px; font-weight: 600; color: #424242; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; text-transform: none; }
.order-label .ico { color: #616161; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.order-label .ico svg { width: 16px; height: 16px; }
/* Nút trên đầu cửa sổ đơn: biểu tượng nét mảnh + chữ */
.o-tool { display: inline-flex; align-items: center; gap: 6px; color: #424242; }
.o-tool svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.o-tool:hover { color: var(--accent); }
.o-close { display: inline-flex; align-items: center; justify-content: center; color: #424242; border-radius: 6px; }
.o-close svg { width: 18px; height: 18px; }
.order-banner-icon svg { width: 32px; height: 32px; color: #fff; display: block; }
.act-detail-ico svg { width: 20px; height: 20px; color: #fff; }
/* Biểu tượng nhỏ ở danh sách / thẻ Kanban */
.meta-ico { display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; color: #616161; }
.meta-ico svg { width: 14px; height: 14px; flex-shrink: 0; }
.meta-ico.done-files { color: var(--brand-green); }
.order-value { min-height: 24px; word-break: break-word; }
.order-value .placeholder { color: #9aa2b1; }
.order-value .pre { white-space: pre-wrap; font-size: 13.5px; }
.order-value input, .order-value select, .order-value textarea { padding: 5px 8px; }
.order-value textarea { min-height: 70px; }
/* Sửa nhanh từng ô (giống Microsoft Lists) */
.order-field.inline-editable .order-value { border-radius: 4px; padding: 3px 6px; margin: -3px -6px; cursor: pointer; border: 1px solid transparent; }
.order-field.inline-editable:hover .order-value { background: #f3f4f8; border-color: #e1e4ec; }
.order-field.inline-editing .order-value, .order-field.inline-editing:hover .order-value { background: transparent; border-color: transparent; cursor: default; }
.order-field.saving { opacity: .55; pointer-events: none; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; background: #fde7f0; border: 1px solid #f5a8c8; border-radius: 8px; padding: 3px 12px 3px 4px; font-weight: 600; color: #a8336d; font-size: 13px; }
.person-chip .avatar { width: 24px; height: 24px; font-size: 10px; }
.order-foot { display: flex; align-items: center; gap: 8px; padding-top: 14px; }
/* Đính kèm của đơn: 2 khu vực */
.att-zones { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border-bottom: 0; padding-bottom: 4px; }
.att-zone { position: relative; border: 1px solid #e0e0e0; border-radius: 8px; background: #fff; display: flex; flex-direction: column; min-width: 0; }
.att-zone.k-order { border-top: 3px solid var(--brand-blue); }
.att-zone.k-done { border-top: 3px solid var(--brand-green); }
.att-zone.drop { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft); }
.att-zone-head { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px 8px; border-bottom: 1px solid #f0f0f0; }
.att-zone-ico { display: inline-flex; margin-top: 1px; }
.k-order .att-zone-ico { color: var(--brand-blue); }
.k-done .att-zone-ico { color: var(--brand-green); }
.att-zone-title { font-weight: 700; font-size: 13.5px; color: #242424; }
.att-zone-count { font-weight: 600; font-size: 12px; color: #616161; background: #f0f0f0; border-radius: 9px; padding: 0 7px; margin-left: 4px; }
.att-zone-count:empty { display: none; }
.att-zone-desc { font-size: 12px; color: #616161; margin-top: 1px; }
.att-add { flex-shrink: 0; }
.att-zone-list { padding: 6px 8px 8px; min-height: 64px; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 6px; }
.att-row:hover { background: #f7f7f7; }
.att-type { flex-shrink: 0; width: 28px; height: 32px; border-radius: 3px; color: #fff; font-size: 9px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; }
.att-main { flex: 1; min-width: 0; }
.att-main a { display: block; font-weight: 600; font-size: 13px; color: #242424; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-main a:hover { color: var(--accent); }
.att-meta { font-size: 11.5px; color: #8a8886; }
.att-btn { border: 0; background: none; color: #8a8886; width: 26px; height: 26px; border-radius: 4px; cursor: pointer; flex-shrink: 0; visibility: hidden; font-size: 13px; }
.att-row:hover .att-btn { visibility: visible; }
.att-btn:hover { background: #ececec; color: var(--accent); }
.att-btn.del:hover { color: var(--danger); background: #fdeaea; }
.att-empty { color: #8a8886; font-size: 12.5px; text-align: center; padding: 18px 8px; border: 1px dashed #e0e0e0; border-radius: 6px; }
.att-busy { display: none; font-size: 12px; color: var(--accent-dark); padding: 0 12px 8px; }
.att-zone.busy .att-busy { display: block; }
.att-note { font-size: 12px; margin: 6px 0 0; }
.done-files { color: var(--brand-green); font-weight: 600; }
@media (max-width: 860px) { .att-zones { grid-template-columns: 1fr; } .att-btn { visibility: visible; } }
/* Cuộc trò chuyện của đơn — mô phỏng khung "Cuộc trò chuyện" của Microsoft Teams */
.order-side.oc { background: #fff; border-left: 1px solid #e0e0e0; display: flex; flex-direction: column; min-height: 0; border-radius: 0 0 14px 0;
  height: 100%; overflow: hidden; font-family: "Segoe UI", system-ui, sans-serif; }
.oc-list { overscroll-behavior: contain; }
.order-side.oc.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.oc-head { padding: 14px 18px; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; }
.oc-title { font-weight: 700; font-size: 16px; color: #242424; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px 14px; background: #fff; }
.oc-empty { text-align: center; color: #616161; margin-top: 70px; font-size: 13px; line-height: 1.6; padding: 0 10px; }
.oc-empty-ico { font-size: 40px; margin-bottom: 6px; }
.oc-day { text-align: right; font-size: 12px; color: #616161; margin: 14px 4px 2px; }
.oc-msg { display: flex; gap: 8px; margin-top: 14px; }
.oc-msg.grouped { margin-top: 3px; }
.oc-av { width: 32px; flex-shrink: 0; }
.oc-av .avatar { width: 32px; height: 32px; font-size: 11.5px; }
.oc-col { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.oc-meta { font-size: 12px; color: #616161; margin: 0 0 3px 2px; display: flex; gap: 8px; align-items: baseline; }
.oc-name { color: #424242; }
.oc-bubble { position: relative; background: #f5f5f5; border-radius: 6px; padding: 8px 12px; max-width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.oc-bubble:hover { background: #f0f0f0; }
.oc-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; color: #242424; line-height: 1.45; }
.oc-text a { color: var(--accent); }
.oc-text .mention { background: none; color: var(--accent); padding: 0; font-weight: 400; }
.oc-img img { display: block; max-width: 100%; max-height: 260px; border-radius: 4px; border: 1px solid #e0e0e0; background: #fff; }
.oc-file { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; padding: 8px 12px; min-width: 220px; max-width: 100%; color: #242424; text-decoration: none; }
.oc-file:hover { background: #fafafa; border-color: #c7c7c7; text-decoration: none; }
.oc-file-ico { flex-shrink: 0; width: 30px; height: 34px; border-radius: 3px; color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; }
.oc-file-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-file-size { font-size: 11.5px; color: #616161; flex-shrink: 0; }
/* Tin của mình: bên phải, nền tím nhạt, không ảnh đại diện (giống Teams) */
.oc-msg.mine { justify-content: flex-end; }
.oc-msg.mine .oc-col { align-items: flex-end; flex: 0 1 auto; max-width: 85%; }
.oc-msg.mine .oc-meta { margin: 0 2px 3px 0; }
.oc-msg.mine .oc-bubble { background: var(--accent-soft); align-items: flex-end; }
.oc-msg.mine .oc-bubble:hover { background: var(--accent-soft-2); }
.oc-msg:not(.mine) .oc-col { max-width: calc(100% - 40px); flex: 0 1 auto; }
.oc-edited { font-size: 11.5px; color: #616161; }
.oc-text b { font-weight: 700; }
.oc-text ul, .oc-text ol { margin: 2px 0; padding-left: 22px; white-space: normal; }
.oc-text .hl { background: #fff100; }
.fs-sm { font-size: 12px; } .fs-lg { font-size: 18px; } .fs-xl { font-size: 24px; line-height: 1.25; }
/* Nút Sửa / Xoá hiện khi rê chuột vào tin */
.oc-actions { position: absolute; top: -14px; right: 4px; display: none; gap: 1px; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; padding: 1px; box-shadow: 0 2px 6px rgba(0,0,0,.12); z-index: 2; }
.oc-bubble:hover .oc-actions { display: flex; }
.oc-actions button { border: 0; background: none; color: #616161; width: 26px; height: 24px; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.oc-actions button:hover { background: #f0f0f0; color: var(--accent); }
.oc-actions button[data-del-cmt]:hover { color: var(--danger); }
/* Ô soạn tin */
.oc-composer { position: relative; margin: 8px 14px 14px; border: 1px solid #e0e0e0; border-bottom: 2px solid var(--accent); border-radius: 6px; background: #fff; }
.oc-input { outline: none; padding: 10px 12px 2px; font-size: 14px; min-height: 40px; max-height: 220px; overflow-y: auto; word-break: break-word; color: #242424; line-height: 1.45; }
.oc-input.empty::before { content: attr(data-placeholder); color: #8a8886; pointer-events: none; position: absolute; }
.oc-input ul, .oc-input ol { margin: 2px 0; padding-left: 22px; }
.oc-input .hl { background: #fff100; }
.oc-input .mention, .oc-text .mention { background: none; color: var(--accent); padding: 0; font-weight: 400; }
.oc-tools { display: flex; align-items: center; gap: 2px; padding: 2px 6px 6px; }
.oc-tool { border: 0; background: none; color: #616161; font-size: 15px; width: 30px; height: 28px; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.oc-tool:hover, .oc-tool.on { background: #f0f0f0; color: var(--accent); }
.oc-tool.send { color: var(--accent); }
.oc-tool.oc-m, .oc-rec { display: none; }   /* nút riêng của điện thoại — xem khối @media 600px */
/* Đoạn ghi âm trong tin nhắn */
.fcard.voice { padding: 8px 10px; min-width: 250px; }
.voice-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--accent); }
.voice-head svg { width: 18px; height: 18px; flex: none; }
.voice-head .fcard-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #242424; }
.fcard.voice audio { width: 100%; height: 36px; display: block; }
/* Bảng chọn trượt từ dưới lên (nút + trên điện thoại) */
.m-sheet-bg { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, 0); transition: background .2s; display: flex; align-items: flex-end; }
.m-sheet-bg.open { background: rgba(0, 0, 0, .4); }
.m-sheet { width: 100%; max-height: 80vh; overflow-y: auto; background: #fff; border-radius: 16px 16px 0 0; padding: 6px 0 calc(10px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s ease-out; box-shadow: 0 -4px 20px rgba(0, 0, 0, .15); }
.m-sheet-bg.open .m-sheet { transform: none; }
.m-sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: #c8c8c8; margin: 4px auto 8px; }
.m-sheet-title { font-weight: 600; font-size: 16px; padding: 4px 20px 10px; color: #242424; }
.m-sheet-sep { height: 1px; background: #ececec; margin: 6px 0; }
.m-sheet-item { display: flex; align-items: center; gap: 18px; width: 100%; border: 0; background: none; padding: 12px 22px; text-align: left; cursor: pointer; color: #242424; font: inherit; }
.m-sheet-item:active { background: #f0f0f0; }
.m-sheet-item:disabled { opacity: .45; }
.m-sheet-ico { width: 26px; height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.m-sheet-ico svg { width: 24px; height: 24px; }
.m-sheet-txt { display: flex; flex-direction: column; min-width: 0; }
.m-sheet-txt b { font-weight: 400; font-size: 17px; }
.m-sheet-txt small { color: #707070; font-size: 13px; margin-top: 1px; }
/* Thanh tiến trình tải / cài bản cập nhật (ứng dụng điện thoại, máy chủ, ứng dụng máy tính); .busy = đang cài, chưa biết phần trăm */
.upd-prog { position: relative; height: 6px; border-radius: 3px; background: #e3e3e3; overflow: hidden; margin-top: 7px; width: 100%; }
.upd-prog i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width .3s ease; }
.upd-prog.busy i { width: 35%; animation: upd-busy 1.2s ease-in-out infinite; }
@keyframes upd-busy { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.apk-upd-row .upd-prog { flex-basis: 100%; order: 3; }
.dk-upd .ci-txt { min-width: 280px; flex: 1; }
.restart-card .upd-prog { margin-top: 4px; }
.upd-prog-txt { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: #616161; margin-top: 4px; }
/* Biểu ngữ tin nhắn đến trên điện thoại (mobile.js · mobBanner): thẻ trắng trượt xuống từ mép trên */
.m-banner { position: fixed; z-index: 1000; left: 8px; right: 8px; top: calc(8px + env(safe-area-inset-top)); display: flex; align-items: flex-start; gap: 11px;
  background: #fff; border-radius: 14px; padding: 11px 6px 11px 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .22), 0 0 0 1px rgba(0, 0, 0, .05);
  transform: translateY(calc(-100% - 24px)); transition: transform .25s ease-out; cursor: pointer; touch-action: pan-x; }
.m-banner.in { transform: none; }
.m-banner > .avatar { width: 40px; height: 40px; font-size: 14px; flex: none; }
.m-banner-app { background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.m-banner-app svg { width: 20px; height: 20px; }
.m-banner-txt { flex: 1; min-width: 0; line-height: 1.3; }
.m-banner-top { display: flex; align-items: baseline; gap: 8px; }
.m-banner-top b { flex: 1; min-width: 0; font-size: 15px; color: #242424; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-banner-top span { flex: none; font-size: 12px; color: #707070; }
.m-banner-txt small { display: block; font-size: 12.5px; color: #616161; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-banner-txt p { margin: 3px 0 0; font-size: 14px; color: #424242; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.m-banner-x { flex: none; width: 32px; height: 32px; margin: -4px 0 0; border: 0; background: none; color: #707070; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.m-banner-x svg { width: 16px; height: 16px; }
/* Bảng chọn thay cho hộp chọn (select) trên điện thoại: chữ vừa, dấu ✓ bên phải mục đang chọn */
.m-sheet.m-pick .m-sheet-title { font-size: 15px; padding: 2px 18px 8px; border-bottom: 1px solid #ececec; margin-bottom: 4px; }
.m-sheet.m-pick .m-sheet-item { padding: 11px 18px; gap: 10px; }
.m-sheet.m-pick .m-sheet-txt { flex: 1; }
.m-sheet.m-pick .m-sheet-txt b { font-size: 15px; }
.m-sheet.m-pick .m-sheet-ico { order: 2; width: 20px; height: 20px; }
.m-sheet.m-pick .m-sheet-ico svg { width: 18px; height: 18px; }
.m-sheet.m-pick .m-sheet-item.on { color: var(--accent); background: var(--accent-soft); }
.m-sheet.m-pick .m-sheet-item.on b { font-weight: 600; }
.m-sheet-head { font-size: 12px; font-weight: 700; color: #616161; text-transform: uppercase; padding: 10px 18px 4px; }
/* Máy ảnh trong ứng dụng */
.oc-cam { position: fixed; inset: 0; z-index: 950; background: #000; display: flex; flex-direction: column; }
.oc-cam video { flex: 1; width: 100%; min-height: 0; object-fit: cover; background: #000; }
.oc-cam.front video { transform: scaleX(-1); }
.oc-cam-top { position: absolute; top: 0; left: 0; right: 0; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; display: flex; }
.oc-cam-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 28px calc(26px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(transparent, rgba(0, 0, 0, .45)); }
.oc-cam-btn { width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .35); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.oc-cam-btn.ghost { visibility: hidden; }
.oc-cam-shot { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: none; padding: 4px; cursor: pointer; }
.oc-cam-shot span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
.oc-cam-shot:active span { transform: scale(.9); }
.oc-sep { width: 1px; height: 18px; background: #e0e0e0; margin: 0 4px; display: inline-block; }
.oc-editing { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--accent); padding: 6px 10px 0 12px; }
.oc-editing[hidden] { display: none; }
.oc-fmt { display: flex; align-items: center; flex-wrap: wrap; gap: 1px; padding: 5px 6px; border-bottom: 1px solid #edebe9; }
.oc-fmt[hidden] { display: none; }
.oc-fbtn { border: 0; background: none; color: #424242; min-width: 28px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.oc-fbtn:hover { background: #f0f0f0; }
.oc-fbtn.on { background: var(--accent-soft); color: var(--accent); }
.oc-hl-ico { background: #fff100; padding: 0 2px; font-size: 12px; }
.oc-color-ico { border-bottom: 3px solid #d13438; line-height: 1; padding: 0 2px; }
.oc-dd { position: relative; display: inline-flex; }
.oc-pop { position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.15); padding: 6px; z-index: 6; display: flex; gap: 4px; }
.oc-pop[hidden] { display: none; }
.oc-pop.list { flex-direction: column; min-width: 110px; }
.oc-dd .oc-pop { left: auto; right: 0; }
.oc-pop.up { top: auto; bottom: 100%; left: auto; right: 0; margin-bottom: 4px; }
.oc-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #c8c6c4; cursor: pointer; }
.oc-swatch:hover { box-shadow: 0 0 0 2px var(--accent); }
.oc-size { border: 0; background: none; text-align: left; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.oc-size:hover { background: #f0f0f0; }
#oc-emoji { flex-wrap: wrap; width: 292px; max-height: 210px; overflow-y: auto; gap: 2px; }
.oc-emo { border: 0; background: none; font-size: 20px; width: 32px; height: 32px; border-radius: 4px; cursor: pointer; }
.oc-emo:hover { background: #f0f0f0; }
/* Khay xem trước tệp / ảnh trong ô soạn (chưa gửi) */
.oc-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px 2px; max-height: 260px; overflow-y: auto; }
.oc-tray[hidden] { display: none; }
.oc-att { position: relative; border: 1px solid #e0e0e0; border-radius: 6px; background: #fafafa; }
.oc-att.img { width: auto; height: 110px; max-width: 220px; overflow: hidden; }
.oc-att.img img { height: 110px; width: auto; max-width: 220px; object-fit: cover; display: block; }
.oc-att.file { display: flex; align-items: center; gap: 8px; padding: 8px 30px 8px 8px; max-width: 260px; background: #fff; }
.oc-att-txt { display: flex; flex-direction: column; min-width: 0; }
.oc-att-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-att-size { font-size: 11.5px; color: #8a8886; }
.oc-att-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; cursor: pointer; display: none; align-items: center; justify-content: center; }
.oc-att:hover .oc-att-x, .oc-att.file .oc-att-x { display: inline-flex; }
.oc-att.file .oc-att-x { background: transparent; color: #616161; }
.oc-att.file .oc-att-x:hover { background: #eee; }
.oc-att.up img { opacity: .55; }
.oc-att-busy { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 3px solid rgba(0,0,0,.15); border-top-color: var(--accent); border-radius: 50%; animation: oc-spin .8s linear infinite; }
.oc-att.file .oc-att-busy { position: static; margin: 0; flex-shrink: 0; width: 16px; height: 16px; border-width: 2px; }
@keyframes oc-spin { to { transform: rotate(360deg); } }
.oc-att.err { border-color: #c4314b; }
.oc-att-err { position: absolute; left: 6px; bottom: 6px; background: #c4314b; color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.oc-hint { font-size: 12px; color: #616161; padding-left: 6px; }
/* Ô soạn trong màn hình Tin nhắn */
.chat-main .oc-composer { margin: 8px 20px 14px; }
.chat-main.drop .msg-list { outline: 2px dashed var(--accent); outline-offset: -6px; }
.bubble .msg-cap { margin-top: 6px; }
.bubble .oc-text ul, .bubble .oc-text ol { margin: 2px 0; padding-left: 20px; }
.bubble .hl { background: #fff100; }
.bubble .fs-sm { font-size: 12px; } .bubble .fs-lg { font-size: 17px; } .bubble .fs-xl { font-size: 21px; }
.mention-pop.up { top: auto; bottom: 100%; margin-bottom: 4px; }
.mention { background: var(--accent-soft); color: var(--accent-dark); border-radius: 4px; padding: 0 3px; font-weight: 600; }
/* Lịch sử chỉnh sửa */
.hist-filters input[type=date] { min-width: 0; }
.hist-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent-dark); border-radius: 16px; padding: 3px 4px 3px 12px; font-size: 13px; }
.hist-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: stretch; }
.hist-stat { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 18px; min-width: 110px; }
.hist-stat .n { font-size: 22px; font-weight: 700; }
.hist-stat .l { font-size: 12px; color: var(--muted); }
.hist-people { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hist-person { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px 6px 6px; cursor: pointer; text-align: left; font: inherit; }
.hist-person > span { display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.3; }
.hist-person:hover { border-color: #b9c4dc; }
.hist-person.on { border-color: var(--primary); background: var(--accent-soft); }
.hist-who { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.hist-who .avatar { width: 24px; height: 24px; font-size: 10px; }
table.hist-table td { vertical-align: top; }
.hist-body { word-break: break-word; }
.mention-wrap { position: relative; }
.mention-pop { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(20,30,60,.15); z-index: 5; max-height: 240px; overflow-y: auto; }
.mention-pop[hidden] { display: none; }
.mention-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.mention-item:hover, .mention-item:first-child { background: #f0f4ff; }
.kboard { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; min-height: calc(100vh / var(--zoom, 1) - 220px); }
.kboard .column { flex: 0 0 280px; max-height: calc(100vh / var(--zoom, 1) - 220px); display: flex; flex-direction: column; }
.kboard .cards { overflow-y: auto; min-height: 60px; padding: 2px; }
.kboard .column-head { gap: 6px; }
.kboard .column-head .avatar { width: 24px; height: 24px; font-size: 10px; }
.ocard .ocard-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.ocard .ocard-top .spacer { flex: 1; }
.ocard .pill-list.small { gap: 4px; margin-bottom: 6px; }
.ocard .pill-list.small .opt { font-size: 11.5px; padding: 0 7px; }
.ocard .ocard-note { font-size: 12px; color: var(--muted); margin-bottom: 6px; word-break: break-word; }
.ocard .meta .opt { font-size: 11.5px; }
.toolbar + .toolbar { margin-top: -6px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.opt-card { padding: 12px 14px; }
.opt-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.opt-row { display: flex; align-items: center; gap: 2px; padding: 4px 0; border-bottom: 1px solid #f1f2f6; }
.opt-add { display: flex; gap: 6px; margin-top: 10px; }
.opt-add select { width: 110px; flex-shrink: 0; }
/* Trường & danh mục của kênh */
.fs-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: -4px 0 14px; }
.fs-pick label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.fs-pick select { min-width: 260px; }
.fs-card { padding: 12px 14px; margin-bottom: 18px; }
.fs-table td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
.fs-table tr.is-hidden td:not(:nth-child(5)) { opacity: .5; }
.fs-move { white-space: nowrap; }
.ft-type { display: inline-flex; align-items: center; gap: 6px; color: #424242; font-size: 13px; }
.ft-type svg { width: 16px; height: 16px; color: var(--accent-dark); }
.tag-builtin { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; margin-left: 4px; font-weight: 400; }
.fs-add { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.fs-add input[name=label] { flex: 2; min-width: 180px; }
.fs-add select { width: 190px; }
.fs-add input[name=section] { flex: 1; min-width: 140px; }
.fs-sub { font-size: 15px; margin: 6px 0 10px; }
.opt-card.is-hidden { opacity: .6; }

@media (max-width: 1100px) {
  .order-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Màn hình hẹp: chi tiết và trò chuyện xếp chồng, cả cửa sổ cuộn như cũ */
  .modal.wide.order-modal { height: auto; display: block; overflow: visible; }
  .order-wrap { grid-template-columns: 1fr; }
  .order-main { overflow: visible; }
  .order-side, .order-side.oc { border-left: 0; border-top: 1px solid var(--border); border-radius: 0 0 14px 14px; position: static; height: 75vh; }
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 64px clamp(220px, var(--pane-w, 280px), 44vw) minmax(0, 1fr); }
  .pane-resizer { left: calc(64px + clamp(220px, var(--pane-w, 280px), 44vw) - 3px); }
}
@media (max-width: 860px) {
  /* Điện thoại: Tin nhắn / Thông báo xem danh sách hoặc chi tiết; Công việc / Cài đặt hiện mục dạng dải ngang phía trên */
  .shell { grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .pane-resizer { display: none; }
  .rail { grid-row: 1 / 3; }
  .rail-label { display: none; }
  .rail-btn { width: 48px; padding: 9px 0; }
  .pane { grid-column: 2; grid-row: 1 / 3; border-right: 0; }
  .page, .page.flush { grid-column: 2; grid-row: 1 / 3; display: none; }
  .page { padding: 14px; }
  .shell.show-main .pane { display: none; }
  .shell.show-main .page { display: block; }
  .shell.show-main .page.flush { display: flex; }
  .shell[data-section=work] .pane, .shell[data-section=settings] .pane { display: flex; grid-row: 1; border-bottom: 1px solid #e0e0e0; }
  .shell[data-section=work] .page, .shell[data-section=settings] .page { display: block; grid-row: 2; }
  .shell[data-section=work] .pane-head, .shell[data-section=settings] .pane-head { display: none; }
  .shell[data-section=work] .pane-body, .shell[data-section=settings] .pane-body { display: flex; gap: 4px; overflow-x: auto; padding: 6px 8px; align-items: center; }
  .shell[data-section=work] .pane-group { display: none; }
  .pane-item { white-space: nowrap; padding: 6px 10px; }
  .pane-new { margin: 0 0 0 6px; }
  .act-detail-head .back { display: inline-block; }
  .shell[data-section=settings] .set-search { padding: 8px 8px 0; }
  .set-item { white-space: nowrap; flex-shrink: 0; }
  .set-group { display: none; }
  .set-foot { display: none; }
  .set-card { padding: 14px 14px 16px; }
  .set-card-body { padding-left: 0; }
  .set-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .set-select, .set-input { min-width: 0; width: 100% !important; }
  .set-kv { grid-template-columns: 1fr; gap: 2px; }
  .set-kv > div:nth-child(even) { margin-bottom: 8px; word-break: break-all; }
  .set-tile { width: calc(50% - 5px); }
  .chat-head .back { display: inline-block; }
  .msg-col { max-width: 85%; }
  .task-layout { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 260px); }
  .brand span { display: none; }
  .user-chip .uname { display: none; }
  .notif-panel { width: 300px; }
}

/* ---------- Dạng xem đơn hàng (giống SharePoint / Teams) ---------- */
.view-bar { display: flex; align-items: center; gap: 10px; margin: -4px 0 6px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; height: 34px; width: 240px; color: var(--muted); }
.search-box input { border: 0; padding: 0; height: 32px; box-shadow: none !important; background: transparent; }
/* Các dạng xem dồn sát bên phải, ngăn cách bằng vạch dọc "|" như Teams (margin-left:auto thay cho justify-content để vẫn cuộn được khi nhiều) */
.view-tabs { display: flex; align-items: center; gap: 0; flex: 1 1 320px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tabs > :first-child { margin-left: auto; }
.view-tab { border: 0; background: none; padding: 7px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; position: relative; display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; margin: 0 1px; }
.view-tab + .view-tab::before, .view-add::before { content: ''; position: absolute; left: -2px; top: 28%; bottom: 28%; width: 1px; background: #cfd4de; }
.view-tab .vt-ico { display: inline-flex; color: var(--accent-dark); }
.view-tab .vt-ico svg { width: 15px; height: 15px; }
.view-tab:hover { background: #eef1f5; color: var(--text); }
.view-tab.active { color: var(--accent-dark); }
.view-tab.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2.5px; border-radius: 2px; background: var(--accent); }
.view-tab .lock { font-size: 11px; }
.view-tab .view-more { font-size: 11px; padding: 0 2px; border-radius: 4px; }
.view-tab .view-more:hover { background: var(--accent-soft); }
.view-add { border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px 7px 12px; border-radius: 6px; white-space: nowrap; font-size: 13.5px; position: relative; margin-left: 4px; }
.view-add:hover { background: #eef1f5; color: var(--text); }
.view-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; min-height: 26px; }
.view-summary b { color: #4a5263; font-weight: 600; }
.view-summary .sep { margin: 0 8px; color: #c9cfdb; }
.temp-chip { background: var(--accent-soft); color: var(--accent-dark); border-radius: 12px; padding: 2px 4px 2px 10px; display: inline-flex; align-items: center; gap: 4px; }
.temp-chip button { border: 0; background: none; cursor: pointer; color: inherit; border-radius: 50%; width: 20px; height: 20px; }
.temp-chip button:hover { background: var(--accent-soft-2); }
table.orders th.gcol, table.orders td.gcol { width: 18px; padding: 0 0 0 8px; }
tr.group-row td { background: #f7f8fb; font-weight: 700; font-size: 13px; cursor: pointer; color: #1d2433; padding-top: 9px; padding-bottom: 9px; }
tr.group-row:hover td { background: #eef1f6; }
tr.group-row .g-chev { display: inline-block; width: 18px; color: var(--muted); transition: transform .15s; }
tr.group-row.collapsed .g-chev { transform: rotate(-90deg); }
tr.group-row .opt { font-weight: 600; }
.list-foot { padding: 10px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid #eef0f5; }
.cell-text { color: #4a5263; font-size: 13px; }
.view-editor .flabel { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.view-editor label.radio { display: flex; align-items: center; gap: 7px; margin: 4px 0; font-size: 13.5px; cursor: pointer; }
.view-editor label.radio input { width: auto; margin: 0; }
.ve-section { border-top: 1px solid var(--border); padding: 12px 0 4px; margin-top: 6px; }
.ve-title { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.ve-title .muted { font-weight: 400; font-size: 12.5px; }
.ve-section .row { align-items: center; }
.ve-cond { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; padding: 8px; background: #f7f8fb; border-radius: 8px; }
.ve-cond > select { flex: 0 0 210px; }
.ve-cond > select[data-f=op] { flex: 0 0 190px; }
.ve-cond .ve-val { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ve-cond .ve-val input { width: auto; }
.ve-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; }
.ve-col { display: flex; align-items: center; justify-content: space-between; padding: 3px 6px; border-radius: 6px; font-size: 13px; }
.ve-col.on { background: var(--accent-soft); }
.ve-col label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ve-col input { width: auto; margin: 0; }

/* Bố cục danh sách: nhỏ gọn / chiều cao tự động */
table.orders.ly-compact th, table.orders.ly-compact td { padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
table.orders.ly-compact .avatar { width: 22px; height: 22px; font-size: 9.5px; }
table.orders.ly-compact .opt { padding: 0 8px; font-size: 12px; }
table.orders.ly-auto td { white-space: normal; vertical-align: top; }
table.orders.ly-auto td .pill-list, table.orders.ly-auto td .opt { white-space: nowrap; }
.cell-text.full { white-space: pre-wrap; display: block; min-width: 220px; max-width: 420px; word-break: break-word; }
.dirty-note { font-size: 12px; color: #a36300; background: #fff4dc; border-radius: 10px; padding: 1px 8px; }

/* Tô màu hàng theo quy tắc định dạng (giống hàng đỏ trên Teams) */
tr.row-c-red td { background: #fde0de; } tr.row-c-red:hover td { background: #fbcfcc; }
tr.row-c-orange td { background: #ffe8d4; } tr.row-c-orange:hover td { background: #ffdcbd; }
tr.row-c-yellow td { background: #fff5cc; } tr.row-c-yellow:hover td { background: #ffeeaa; }
tr.row-c-green td { background: #ddf3e4; } tr.row-c-green:hover td { background: #c9ebd4; }
tr.row-c-blue td { background: #e0eaff; } tr.row-c-blue:hover td { background: #cfdcff; }
tr.row-c-purple td { background: #efe5fb; } tr.row-c-purple:hover td { background: #e3d3f7; }
tr.row-c-gray td { background: #eceef2; } tr.row-c-gray:hover td { background: #e1e4ea; }
.ocard.row-c-red { background: #fde0de; } .ocard.row-c-orange { background: #ffe8d4; } .ocard.row-c-yellow { background: #fff5cc; }
.ocard.row-c-green { background: #ddf3e4; } .ocard.row-c-blue { background: #e0eaff; } .ocard.row-c-purple { background: #efe5fb; } .ocard.row-c-gray { background: #eceef2; }

/* Hộp "Định dạng chế độ xem hiện tại" */
.fm-rule { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; border-left-width: 5px; }
.fm-rule.row-c-red { border-left-color: #e5534b; } .fm-rule.row-c-orange { border-left-color: #f08a24; } .fm-rule.row-c-yellow { border-left-color: #e3b200; }
.fm-rule.row-c-green { border-left-color: #2da44e; } .fm-rule.row-c-blue { border-left-color: #3b6fe0; } .fm-rule.row-c-purple { border-left-color: #8957e5; } .fm-rule.row-c-gray { border-left-color: #8b93a3; }
.fm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.fm-head select { width: 130px; }
.fm-cond .ve-cond { background: #f7f8fb; margin-bottom: 6px; }
.ve-cols.one { grid-template-columns: 1fr 1fr; }

/* ---------- Hộp Thêm / Sửa dạng xem (bố cục mới) ---------- */
.modal.ve-modal { width: 860px; }
.ve-head { gap: 12px; }
.ve-head-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ve-head-ico svg { width: 20px; height: 20px; }
.ve-head-txt { flex: 1; min-width: 0; }
.ve-head-txt h3 { font-size: 17px; }
.ve-head-txt .muted { font-size: 12.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-modal .modal-head .icon-btn svg { width: 18px; height: 18px; }
.view-editor .req { color: var(--danger); font-style: normal; }
.ve-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 4px 0 7px; }
.ve-tiles { display: grid; gap: 8px; margin-bottom: 14px; }
.ve-tiles.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ve-tiles.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ve-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; transition: border-color .12s, background .12s; min-width: 0; }
.ve-tile:hover { border-color: #b9c2d0; background: #fafbfd; }
.ve-tile.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(16,147,79,.08); }
.ve-tile input { position: absolute; opacity: 0; pointer-events: none; }
.ve-tile-ico { width: 32px; height: 32px; border-radius: 8px; background: #eef1f5; color: #4a5263; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ve-tile.on .ve-tile-ico { background: #fff; color: var(--accent-dark); }
.ve-tile-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ve-tile-txt b { font-size: 13px; font-weight: 600; }
.ve-tile-txt small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.ve-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 4px 0 14px; }
.ve-tab { border: 0; background: none; padding: 9px 14px 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; position: relative; border-radius: 8px 8px 0 0; }
.ve-tab:hover { color: var(--text); background: #f4f6f9; }
.ve-tab.active { color: var(--accent-dark); }
.ve-tab.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--accent); }
.ve-count { background: #e6e9ef; color: #4a5263; border-radius: 9px; font-size: 11px; padding: 0 7px; min-width: 18px; text-align: center; line-height: 18px; }
.ve-count:empty { display: none; }
.ve-tab.active .ve-count { background: var(--accent-soft-2); color: var(--accent-dark); }
.ve-pane { min-height: 250px; }
.ve-hint { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #4a5263; background: #f4f6f9; border-radius: 8px; padding: 7px 10px; margin-bottom: 12px; }
.ve-hint svg { flex-shrink: 0; color: var(--muted); width: 16px; height: 16px; }
.ve-empty { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; border: 1.5px dashed var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; justify-content: center; }
.ve-add, .ve-del, .ve-and { display: inline-flex; align-items: center; gap: 6px; }
.view-editor .ve-cond { border: 1px solid #e6e9ef; background: #fafbfd; padding: 8px; border-radius: 10px; }
.ve-del-cond svg { width: 16px; height: 16px; }
.ve-del-cond:hover { color: var(--danger); background: #fdecec; }
.opt-ico { display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.opt-ico svg { width: 13px; height: 13px; }
.ve-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.ve-card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.ve-card-title svg { color: var(--accent-dark); }
.ve-card-title small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 2px; }
.ve-row { display: flex; gap: 8px; }
.ve-row select:first-child { flex: 1; }
.ve-row .ve-dir { flex: 0 0 150px; }
.ve-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; cursor: pointer; }
.ve-check input { width: auto; margin: 0; }
.sum-ico { display: inline-flex; vertical-align: -2px; }
.sum-ico svg { width: 12px; height: 12px; }
.view-tab .lock { display: inline-flex; color: var(--muted); }
.view-tab .view-more { display: inline-flex; align-items: center; }
tr.group-row .g-chev svg { vertical-align: -1px; }
.temp-chip button { display: inline-flex; align-items: center; justify-content: center; }
.fm-head .btn.link svg, .fm-head .icon-btn svg { width: 15px; height: 15px; }
/* Chọn cột: 2 cột */
.cp { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cp-panel { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.cp-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f7f8fb; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.cp-list { max-height: 300px; overflow-y: auto; padding: 4px; }
.cp-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; font-size: 13px; width: 100%; border: 0; background: none; text-align: left; font: inherit; font-size: 13px; color: inherit; }
.cp-item.on:hover { background: #f4f6f9; }
.cp-item.add { cursor: pointer; }
.cp-item.add:hover { background: var(--accent-soft); color: var(--accent-dark); }
.cp-no { width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-lock { color: var(--muted); display: inline-flex; }
.cp-acts { display: inline-flex; gap: 1px; opacity: .55; }
.cp-item:hover .cp-acts { opacity: 1; }
.cp-btn { border: 0; background: none; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; color: #4a5263; display: inline-flex; align-items: center; justify-content: center; }
.cp-btn:hover:not(:disabled) { background: #e8ecf2; }
.cp-btn.danger:hover:not(:disabled) { background: #fdecec; color: var(--danger); }
.cp-btn:disabled { opacity: .3; cursor: default; }
.cp-plus { color: var(--muted); display: inline-flex; }
.cp-item.add:hover .cp-plus { color: var(--accent-dark); }
.cp-empty { padding: 14px; text-align: center; font-size: 13px; }
/* Cửa sổ hẹp: tin nhắn, ô nhập và thông báo vẫn đủ chỗ */
@media (max-width: 860px) {
  .client-invite { left: 64px; right: 8px; max-width: none; bottom: 132px; }
  .client-invite .ci-txt small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-width: 600px) {
  .msg-list { padding: 12px 10px; }
  .msg-col { max-width: 86%; }
  .msg-img { max-width: 100%; }
  .chat-head { padding: 8px 10px; gap: 8px; }
  .chat-head .avatar { width: 32px; height: 32px; font-size: 12px; }
  .composer { padding: 8px; gap: 6px; }
  .composer .btn { padding: 0 12px; }
  .act-detail-head { padding: 8px 10px; }
  .act-thread { padding: 0; }
}
@media (max-width: 760px) {
  .ve-tiles.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ve-grid2, .cp { grid-template-columns: 1fr; }
}

/* ---------- Cập nhật phần mềm ---------- */
.upd-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.upd-banner.ok { background: #e4f3ea; color: #0a6b38; }
.upd-banner.bad { background: #fdecec; color: #a12622; }
.upd-banner svg { flex-shrink: 0; }
.upd-state { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.upd-state.new { border-color: #b7d3ff; background: #f3f8ff; }
.upd-state.ready { border-color: var(--accent); background: var(--accent-soft); }
.upd-ico { width: 36px; height: 36px; border-radius: 9px; background: #eef1f5; color: #4a5263; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.upd-state.new .upd-ico { background: #dbe7ff; color: #1f4fc4; }
.upd-state.ready .upd-ico { background: #fff; color: var(--accent-dark); }
.upd-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upd-txt small { color: var(--muted); font-size: 12.5px; }
.upd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.upd-actions .btn, .upd-state .btn { display: inline-flex; align-items: center; gap: 6px; }
.btn.disabled { opacity: .55; pointer-events: none; }
.ok-text { color: #0a6b38; } .bad-text { color: var(--danger); }
.restart-overlay { position: fixed; inset: 0; background: rgba(20,28,45,.55); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.restart-card { background: #fff; border-radius: 14px; padding: 26px 30px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--accent-soft-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Ứng dụng cho máy tính ---------- */
.client-steps { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; line-height: 1.9; }
.client-steps code { background: #eef1f5; padding: 1px 6px; border-radius: 5px; }
.client-steps .btn.link { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
/* Khung gợi ý nổi (cài ứng dụng / bật thông báo): nằm trên ô nhập tin nhắn để không che nút Gửi */
.client-invite { position: fixed; right: 18px; bottom: 132px; z-index: 900; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 12px 14px; box-shadow: 0 10px 30px rgba(20,30,60,.18); max-width: 460px; animation: ci-in .25s ease-out; }
.client-invite .ci-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.client-invite .ci-txt { display: flex; flex-direction: column; min-width: 0; }
.client-invite .ci-txt small { color: var(--muted); font-size: 12px; }
@keyframes ci-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Trang Quản lý nhóm (Kênh · Thành viên · Phân tích · Cài đặt) ---------- */
#page:has(> .tm-page) { padding: 0; }
.tm-page { display: flex; flex-direction: column; min-height: 100%; }
.tm-head { display: flex; align-items: center; gap: 12px; padding: 12px 24px 0; border-bottom: 1px solid #e6e6e6; background: #fff; flex-wrap: wrap; }
.tm-title { display: flex; flex-direction: column; margin-right: 12px; min-width: 0; padding-bottom: 12px; }
.tm-title b { font-size: 18px; }
.tm-title span { font-size: 12.5px; color: #616161; }
.tm-tabs { display: flex; gap: 4px; align-self: flex-end; }
.tm-tabs a { padding: 10px 12px; color: #424242; text-decoration: none; border-bottom: 3px solid transparent; font-size: 14px; }
.tm-tabs a:hover { color: var(--accent); }
.tm-tabs a.on { color: #242424; font-weight: 600; border-bottom-color: var(--accent); }
.tm-body { padding: 20px 24px 40px; max-width: 1200px; width: 100%; box-sizing: border-box; }
.tm-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tm-search { width: 100%; padding: 7px 10px; border: 1px solid #d1d1d1; border-radius: 6px; font: inherit; box-sizing: border-box; }
.tm-search.small { width: 220px; }
.tm-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; overflow: hidden; font-size: 13.5px; }
.tm-table th { text-align: left; font-weight: 600; color: #616161; font-size: 12.5px; padding: 9px 12px; background: #fafafa; border-bottom: 1px solid #e6e6e6; }
.tm-table td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.tm-table tr:last-child td { border-bottom: 0; }
.tm-link-row { cursor: pointer; }
.tm-link-row:hover td { background: #f7f7f7; }
.tm-person { display: inline-flex; align-items: center; gap: 9px; }
.tm-person .avatar { width: 28px; height: 28px; font-size: 11px; }
.tm-act { text-align: right; white-space: nowrap; }
.tm-role { padding: 4px 6px; border: 1px solid #d1d1d1; border-radius: 5px; font: inherit; font-size: 13px; background: #fff; }
.btn.link.danger, .btn.danger { color: var(--danger); }
.tm-pick { max-height: 320px; overflow: auto; border: 1px solid #e6e6e6; border-radius: 6px; margin-top: 8px; }
.tm-row { display: flex; align-items: center; gap: 9px; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f3f3f3; }
.tm-row:hover { background: #f7f7f7; }
.tm-row .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.tm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tm-tile { background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tm-tile b { font-size: 26px; font-weight: 600; color: #242424; }
.tm-tile span { font-size: 12.5px; color: #616161; }
.tm-tile.warn b { color: #b86e00; }
.tm-tile.bad b { color: var(--danger); }
.tm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.tm-card { background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; padding: 14px 16px; }
.tm-card h4 { margin: 0 0 12px; font-size: 14px; }
.tm-cols { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.tm-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.tm-col i { display: block; width: 100%; max-width: 24px; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.tm-col span { font-size: 11px; color: #424242; min-height: 13px; }
.tm-col em { font-style: normal; font-size: 10.5px; color: #8a8886; }
.tm-hbar { display: grid; grid-template-columns: 140px 1fr 36px; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.tm-hname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-htrack { background: #f0f0f0; border-radius: 4px; height: 10px; overflow: hidden; }
.tm-htrack i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.tm-hbar b { text-align: right; font-weight: 600; }
.tm-set { background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; }
.tm-set-row { display: grid; grid-template-columns: 280px 1fr; gap: 20px; padding: 16px 20px; border-bottom: 1px solid #f0f0f0; font-size: 13.5px; line-height: 1.7; }
.tm-set-row:last-child { border-bottom: 0; }
.tm-big { font-size: 20px; font-weight: 600; line-height: 1.3; }
.tm-set .btn svg { width: 15px; height: 15px; vertical-align: -3px; }
@media (max-width: 760px) { .tm-set-row { grid-template-columns: 1fr; gap: 6px; } .tm-body { padding: 14px; } }
/* Trang Thành viên kiểu Teams: nhóm Chủ sở hữu / Thành viên và khách, thu gọn được */
.tm-add-link { border: 0; background: none; font: inherit; font-weight: 600; font-size: 14px; color: #242424; cursor: pointer; padding: 6px 4px; display: inline-flex; gap: 8px; align-items: center; }
.tm-add-link b { font-size: 20px; font-weight: 300; line-height: 1; }
.tm-add-link:hover { color: var(--accent); }
.tm-sec { margin-top: 14px; }
.tm-sec-head { border: 0; background: none; font: inherit; font-size: 14px; color: #242424; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 6px 0; }
.tm-chev svg { transform: rotate(90deg); transition: transform .15s; display: block; }
.tm-sec.collapsed .tm-chev svg { transform: none; }
.tm-sec.collapsed .tm-table { display: none; }
.tm-table.flat { border: 0; border-radius: 0; background: transparent; }
.tm-table.flat th { background: transparent; font-weight: 400; color: #424242; font-size: 12px; border-bottom: 0; padding-top: 12px; }
.tm-table.flat td { border-bottom: 1px solid #ececec; padding: 8px 12px; }
.tm-table.flat tbody tr:hover td { background: #f5f5f5; }
.tm-pname { display: inline-flex; flex-direction: column; line-height: 1.25; }
.tm-pname b { font-weight: 400; }
.tm-tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #f0f0f0; color: #424242; }
.tm-x { border: 0; background: none; color: #424242; font-size: 15px; width: 28px; height: 28px; border-radius: 4px; cursor: pointer; }
.tm-x:hover { background: #ececec; color: var(--danger); }
.tm-table.flat .tm-role { border-color: transparent; background: transparent; cursor: pointer; }
.tm-table.flat .tm-role:hover { border-color: #d1d1d1; background: #fff; }
.tm-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.tm-empty { text-align: center; padding: 50px 20px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tm-avatar-row { display: flex; align-items: center; gap: 16px; }
.team-img { object-fit: cover; border-radius: 6px; flex-shrink: 0; display: inline-block; }.tm-sec .tm-table.flat { table-layout: fixed; }
.tm-sec .tm-table.flat th:nth-child(1) { width: 30%; } .tm-sec .tm-table.flat th:nth-child(2) { width: 18%; }
.tm-sec .tm-table.flat th:nth-child(3) { width: 15%; } .tm-sec .tm-table.flat th:nth-child(4) { width: 17%; }
.tm-sec .tm-table.flat th:nth-child(5) { width: 15%; } .tm-sec .tm-table.flat th:nth-child(6) { width: 44px; }
.tm-sec .tm-table.flat td { overflow: hidden; text-overflow: ellipsis; }.tm-req th:nth-child(1) { width: 34%; } .tm-req th:nth-child(3) { width: 130px; } .tm-req th:nth-child(4) { width: 190px; }
.tm-req .tm-pname { gap: 2px; }
td.nowrap { white-space: nowrap; }
/* ========== Ứng dụng ========== */
.app-ico { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: #fff; flex-shrink: 0; line-height: 1; }
.apps-tree .app-row .app-ico { margin-right: 2px; }
.apps-tree .app-home { margin-bottom: 6px; }
.app-cat-ico { width: 24px; text-align: center; font-size: 15px; flex-shrink: 0; }
.app-count { font-size: 11.5px; color: #8a8886; margin-left: auto; padding: 0 4px; }
.team-row .app-count + .tree-more { margin-left: 0; }
.app-none { font-size: 12px; color: #8a8886; padding: 4px 12px 6px 44px; }
.app-ext { color: #8a8886; display: inline-flex; margin-left: auto; }
.app-ext svg { width: 13px; height: 13px; }
#apps-add-mine { font-size: 17px; font-weight: 400; }
#page:has(> .apps-home), #page:has(> .app-view) { padding: 0; }
.apps-home { padding: 22px 28px 40px; max-width: 1200px; }
.apps-home-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.apps-home-head h2 { margin: 0 0 4px; font-size: 20px; }
.apps-sec { margin-top: 22px; }
.apps-sec h3 { font-size: 14px; margin: 0 0 10px; color: #424242; }
.app-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.app-tile { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; padding: 12px; text-decoration: none; color: inherit; transition: box-shadow .15s, border-color .15s; }
a.app-tile:hover { border-color: #c7c7c7; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.app-tile-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.app-tile-txt b { font-size: 14px; }
.app-tile-txt span { font-size: 12.5px; color: #616161; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.app-tile-txt em { font-style: normal; font-size: 11.5px; color: var(--accent); }
.app-tile.sugg { align-items: center; }
.app-tile.soon { background: #fafafa; }
.app-tile.soon em { color: #8a8886; }
.app-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.app-head { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid #e6e6e6; background: #fff; flex-shrink: 0; }
.app-head-txt { display: flex; flex-direction: column; min-width: 0; }
.app-head-txt b { font-size: 16px; }
.app-head-txt span { font-size: 12px; color: #616161; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.app-head .btn svg { width: 14px; height: 14px; vertical-align: -2px; }
.app-body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.app-frame { width: 100%; height: calc(100% - 26px); border: 0; display: block; background: #fff; }
.app-frame-hint { height: 26px; line-height: 26px; font-size: 11.5px; color: #8a8886; padding: 0 14px; border-top: 1px solid #eee; background: #fafafa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-form .seg { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; }
.app-form .seg label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.ap-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ap-row > .field { min-width: 120px; }
.app-icon-pick { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.app-icon-input { width: 56px !important; text-align: center; font-size: 18px; margin-right: 6px; }
.app-icon-opt { border: 1px solid transparent; background: none; font-size: 17px; width: 30px; height: 30px; border-radius: 5px; cursor: pointer; }
.app-icon-opt:hover { background: #f0f0f0; border-color: #e0e0e0; }
.ap-pick .tm-pick { max-height: 180px; }
/* Hợp đồng */
.ct-wrap, .att-wrap, .dir-wrap { padding: 18px 22px 40px; }
button.tm-tile { cursor: pointer; text-align: left; font: inherit; }
.tm-tile.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ct-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ct-table td { vertical-align: top; }
.ct-pill { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: #f0f0f0; color: #424242; white-space: nowrap; }
.ct-pill.ok { background: #e7f3ec; color: #0e700e; }
.ct-pill.warn { background: #fff4ce; color: #8a5300; }
.ct-pill.bad { background: #fde7e9; color: #b10e1c; }
.ct-pill.mute { background: #f0f0f0; color: #616161; }
.ct-files { display: flex; flex-direction: column; gap: 6px; }
.ct-form fieldset, fieldset.ct-form { border: 0; margin: 0; min-width: 0; }
/* Chấm công */
.att-today { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; background: #fff; border: 1px solid #e6e6e6; border-radius: 10px; padding: 16px 22px; margin-bottom: 16px; }
.att-clock { display: flex; flex-direction: column; }
.att-clock b { font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.att-clock span { font-size: 12.5px; color: #616161; }
.att-times { display: flex; gap: 26px; }
.att-times div { display: flex; flex-direction: column; gap: 2px; }
.att-times span { font-size: 12px; color: #616161; }
.att-times b { font-size: 22px; font-variant-numeric: tabular-nums; }
.att-times em { font-style: normal; font-size: 11.5px; }
.att-times em.warn { color: #8a5300; }
.att-btns { margin-left: auto; }
.btn.att-big { font-size: 15px; padding: 10px 22px; }
.att-table tr.sun td { background: #fdf3f4; }
.att-table tr.sat td { background: #f7f7fb; }
.att-table tr.today td { box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.att-grid-wrap { overflow: auto; border: 1px solid #e6e6e6; border-radius: 8px; background: #fff; }
.att-grid { border-collapse: collapse; font-size: 12px; }
.att-grid th, .att-grid td { border: 1px solid #f0f0f0; padding: 4px 5px; text-align: center; min-width: 26px; }
.att-grid th small { display: block; font-weight: 400; color: #8a8886; font-size: 10px; }
.att-grid th.sun, .att-grid th.sat { color: #b10e1c; }
.att-grid .att-name { text-align: left; white-space: nowrap; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 150px; padding: 4px 10px; }
.att-c { cursor: pointer; }
.att-c.on { color: #0e700e; background: #f3faf5; }
.att-c.late { color: #8a5300; background: #fff8e1; }
.att-c:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Danh bạ */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.dir-card { display: flex; gap: 12px; background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; padding: 12px; cursor: pointer; }
.dir-card:hover { border-color: #c7c7c7; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.dir-card .avatar { width: 42px; height: 42px; font-size: 15px; flex-shrink: 0; }
.dir-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12.5px; color: #424242; }
.dir-txt b { font-size: 14px; color: #242424; }
.dir-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.tm-bar select.tm-role, .tm-bar input.tm-role { width: auto; flex: 0 0 auto; padding: 6px 8px; }
.att-wrap .tm-tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }.ct-scroll { overflow-x: auto; border-radius: 8px; }
.ct-table { min-width: 860px; }
.ct-table td { white-space: nowrap; }
.ct-table td:nth-child(2), .ct-table td:nth-child(3) { white-space: normal; min-width: 160px; }
.ct-tiles { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }.field input[type="number"], .field input[type="time"] { width: 100%; padding: 7px 10px; border: 1px solid #d1d1d1; border-radius: 4px; font: inherit; box-sizing: border-box; background: #fff; }.field input[type="url"] { width: 100%; padding: 7px 10px; border: 1px solid #d1d1d1; border-radius: 4px; font: inherit; box-sizing: border-box; background: #fff; }
/* Ứng dụng: biểu tượng SVG + ứng dụng dạng bản ghi */
.svg-ico { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
.btn .svg-ico, .fcard-btn .svg-ico { vertical-align: -3px; }
.app-ico .svg-ico { vertical-align: 0; color: #fff; }
.app-cat-ico { color: #616161; display: inline-flex; justify-content: center; }
.team-row .tree-more .svg-ico { vertical-align: 0; }
.apps-sec h3 { display: flex; align-items: center; gap: 7px; }
.apps-sec-ico { color: #616161; display: inline-flex; }
.app-tile-txt em.have { color: #616161; }
.app-icon-pick { gap: 4px; }
.app-icon-opt { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; color: #424242; border: 1px solid #e6e6e6; background: #fff; }
.app-icon-opt.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.tm-empty-ico { color: #8a8886; }
.dir-txt span .svg-ico { color: #8a8886; vertical-align: -2px; margin-right: 2px; }
.att-c .svg-ico { vertical-align: -1px; }
.tm-tile.info b { color: #0f6cbd; }
.ct-pill.info { background: #e8f1fb; color: #0f548c; }
.rc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.rc-grid .rc-wide { grid-column: 1 / -1; }
.rc-grid .field small { margin-top: 3px; font-size: 11.5px; }
.rc-grid select, .rc-grid textarea { width: 100%; box-sizing: border-box; }
.rc-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rc-note { background: #f5f5f5; border-left: 3px solid var(--accent); padding: 7px 10px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }
.rc-decide { display: flex; align-items: flex-end; gap: 12px; padding: 12px 20px; border-top: 1px solid #eee; background: #fafafa; flex-wrap: wrap; }
.rc-decide .field { flex: 1; margin: 0; min-width: 220px; }
.rc-decide-btns { display: flex; gap: 8px; }
.rc-mine { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.rc-table tr.today td { background: #f3faf5; }
@media (max-width: 640px) { .rc-grid { grid-template-columns: 1fr; } }.ct-wrap .tm-bar { flex-wrap: wrap; row-gap: 8px; }
.ct-wrap .tm-bar select.tm-role { max-width: 220px; }
.rc-mine { white-space: nowrap; }.avatar.sys { color: #616161; }
.avatar.sys svg { width: 18px; height: 18px; }
/* ---------- Nội dung tải xuống (nút ở thanh bên trái + bảng nổi, như Teams) ---------- */
button.rail-btn { border: 0; background: none; cursor: pointer; font: inherit; font-size: 10.5px; color: #616161; margin-bottom: 6px; }
.rail-dl.busy .rail-ico svg { color: var(--accent); animation: dl-bob 1.2s ease-in-out infinite; }
@keyframes dl-bob { 50% { transform: translateY(2px); } }
body.saver .rail-dl.busy .rail-ico svg { animation: none; }
.dl-panel { position: fixed; z-index: 55; width: 380px; max-height: min(620px, calc(100vh - 24px)); display: flex; flex-direction: column; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 10px 34px rgba(0,0,0,.18); overflow: hidden; }
.dl-head { display: flex; align-items: center; gap: 2px; padding: 12px 10px 10px 18px; font-size: 15px; }
.dl-head b { font-weight: 600; }
.dl-q { padding: 0 14px 8px; }
.dl-q input { width: 100%; }
.dl-list { overflow-y: auto; padding: 0 6px 8px; flex: 1; }
.dl-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 10px; border-radius: 6px; position: relative; }
.dl-item:hover { background: #f5f5f5; }
.dl-ico { width: 26px; height: 30px; font-size: 8.5px; margin-top: 2px; }
.dl-main { flex: 1; min-width: 0; }
.dl-name { font-size: 13.5px; color: #242424; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-item.dead .dl-name { color: #8a8a8a; text-decoration: line-through; }
.dl-sub { display: flex; gap: 12px; align-items: center; font-size: 12.5px; margin-top: 3px; color: #616161; }
.dl-sub .muted { margin-left: auto; }
.dl-link { border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); font: inherit; font-size: 12.5px; }
.dl-link:hover { text-decoration: underline; }
.dl-warn { color: #b45309; }
.dl-prog { height: 4px; border-radius: 2px; background: #e6e6e6; margin-top: 6px; overflow: hidden; }
.dl-prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .2s; }
.dl-prog i.indet { animation: dl-indet 1.2s linear infinite; }
@keyframes dl-indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.dl-x { position: absolute; right: 6px; top: 8px; opacity: 0; }
.dl-item:hover .dl-x, .dl-x:focus-visible { opacity: 1; }
.dl-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 20px; color: #616161; text-align: center; font-size: 13.5px; }
.dl-empty svg { width: 34px; height: 34px; color: #9e9e9e; }
.dl-empty small { color: #8a8a8a; }
.dl-foot { font-size: 12px; color: #616161; padding: 10px 18px; border-top: 1px solid #ededed; }
.dl-path { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ---------- Cài đặt → Thiết bị ---------- */
.set-row.dis { opacity: .4; pointer-events: none; }
.set-row small { display: block; font-size: 12px; color: #616161; margin-top: 2px; }
.dv-meter { flex: 0 0 240px; }
.dv-prev { position: relative; width: 100%; max-width: 540px; aspect-ratio: 16 / 9; background: #1b1b1b; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.dv-prev video { width: 100%; height: 100%; object-fit: cover; display: block; }
.dv-prev.mirror video { transform: scaleX(-1); }
.dv-prev-off { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #d0d0d0; font-size: 13px; padding: 20px; text-align: center; }
.dv-prev-lbl { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 11.5px; font-weight: 600; color: #fff; padding: 5px; background: rgba(0,0,0,.45); }
#cl-play svg, #dv-test svg { vertical-align: -3px; }

/* ---------- Ứng dụng → Phần mềm OFT (kho phần mềm) ---------- */
.sw-ver { font-size: 11px; font-weight: 600; color: var(--accent-dark); background: var(--accent-soft); border-radius: 9px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.app-row .sw-ver { margin-left: auto; }
.sw-view { padding: 24px 28px 40px; max-width: 1180px; }
.sw-hero { display: flex; gap: 18px; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid #ececec; }
.sw-hero .app-ico { border-radius: 14px; flex-shrink: 0; }
.sw-hero-txt { flex: 1; min-width: 0; }
.sw-hero-txt h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sw-sum { color: #424242; margin-top: 4px; font-size: 14px; }
.sw-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 8px; font-size: 12.5px; color: #616161; }
.sw-meta a { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.sw-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--accent-dark); background: var(--accent-soft); border-radius: 10px; padding: 2px 9px; }
.sw-badge.mute { color: #616161; background: #efefef; }
.sw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.sw-actions .btn svg, .sw-file .btn svg, .sw-sec h3 svg { vertical-align: -3px; }
.sw-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; margin-top: 20px; }
@media (max-width: 1100px) { .sw-cols { grid-template-columns: 1fr; } }
.sw-sec { background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; padding: 14px 18px 16px; margin-bottom: 14px; }
.sw-sec h3 { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.sw-md { font-size: 13.5px; line-height: 1.6; color: #242424; overflow-wrap: anywhere; }
.sw-md p { margin: 0 0 6px; }
.sw-md ul { margin: 4px 0 8px; padding-left: 22px; }
.sw-md h3, .sw-md h4, .sw-md h5 { margin: 12px 0 6px; font-size: 14px; }
.sw-md code { background: #f3f3f3; border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.sw-file { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f2f2f2; }
.sw-file:first-of-type { border-top: 0; }
.sw-file-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sw-file-txt b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-file-txt span { font-size: 11.5px; color: #616161; }
.sw-prog { height: 22px; border-radius: 6px; background: #eee; position: relative; overflow: hidden; margin-top: 6px; }
.sw-prog i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent-soft-2); transition: width .2s; }
.sw-prog span { position: relative; font-size: 12px; padding: 0 8px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.app-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.app-color { width: 24px; height: 24px; border-radius: 6px; cursor: pointer; position: relative; }
.app-color input { position: absolute; opacity: 0; }
.app-color:has(input:checked) { outline: 2px solid #242424; outline-offset: 2px; }
.sw-clamp { max-height: 240px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
/* Trang phần mềm: thẻ Tổng quan · Có gì mới · Tệp & tài liệu; cột tự xếp theo bề rộng khung (container query) */
.sw-view { container-type: inline-size; }
.sw-hero { border-bottom: 0; padding-bottom: 6px; }
.sw-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e3e3e3; margin: 10px 0 18px; position: sticky; top: 0; background: var(--bg, #f5f5f5); z-index: 2; }
.sw-tab { border: 0; background: none; padding: 10px 14px 9px; font: inherit; font-size: 14px; color: #616161; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.sw-tab:hover { color: #242424; }
.sw-tab.on { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.sw-tab-n { font-size: 11px; font-weight: 600; background: #ececec; color: #424242; border-radius: 9px; padding: 1px 7px; }
.sw-tab.on .sw-tab-n { background: var(--accent-soft); color: var(--accent-dark); }
.sw-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; margin-top: 0; align-items: start; }
.sw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
@container (max-width: 860px) { .sw-cols, .sw-grid { grid-template-columns: 1fr; } }
.sw-side .sw-sec, .sw-grid .sw-sec { margin-bottom: 14px; }
.sw-intro { min-height: 120px; }
.sw-notes { max-width: 860px; }
.sw-ex { margin: 0 0 6px; padding-left: 18px; font-size: 13px; line-height: 1.55; color: #424242; }
.sw-ex li { margin-bottom: 3px; }
.sw-sec .btn.link { padding-left: 0; }
/* Ảnh đại diện (logo) thay cho biểu tượng */
img.app-ico.app-img { object-fit: contain; background: #fff; border: 1px solid #e6e6e6; box-sizing: border-box; padding: 2px; }
.sw-hero img.app-img { padding: 6px; }
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-prev { width: 56px; height: 56px; border-radius: 12px; border: 1px dashed #c8c8c8; display: flex; align-items: center; justify-content: center; color: #9e9e9e; background: #fafafa; overflow: hidden; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }
.logo-row .btn svg { vertical-align: -3px; }
@container (max-width: 860px) { .sw-cols .sw-side { order: -1; } }

/* ---------- Điện thoại (≤ 600px) · ứng dụng Android / iPhone — bố cục kiểu Microsoft Teams trên điện thoại ----------
   Thanh mục ở đáy; mỗi danh sách có đầu trang (ảnh đại diện + tiêu đề lớn + nút); mở một mục → trang chi tiết
   có nút ‹ và ẩn thanh mục ở đáy. Công việc / Ứng dụng / Cài đặt: lớp m-detail trên #shell do mobile.js bật / tắt.
   Phần tử do mobile.js thêm: .m-me (ảnh đại diện ở đầu trang), .m-crumb (đầu trang chi tiết), .m-fab (Tin nhắn mới). */
.m-crumb, .m-fab, .m-me, .dropdown .m-only { display: none; }
@media (max-width: 600px) {
  .dropdown button.m-only { display: block; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: calc(100dvh / var(--zoom, 1));
    padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .pane-resizer { display: none; }
  .pane, .page, .page.flush { grid-column: 1; grid-row: 1 / 3; border: 0; }
  .page { padding: 12px; }

  /* Thanh mục ở đáy */
  .rail { grid-column: 1; grid-row: 3; flex-direction: row; align-items: stretch; justify-content: space-around; gap: 0;
    padding: 3px 2px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid #e3e3e3; background: #fafafa; }
  .rail-brand, .rail > span, .rail-dl, .rail-me { display: none; }
  .rail-btn { flex: 1; width: auto; min-width: 0; max-width: 96px; padding: 6px 0 3px; gap: 3px; color: #616161; border-radius: 0; }
  .rail-btn:hover { background: none; }
  .rail-ico svg { width: 25px; height: 25px; }
  .rail-label { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .rail-btn.active { color: var(--accent); }
  .rail-btn.active::before { display: none; }
  .rail .badge { top: -6px; right: -12px; border: 2px solid #fafafa; min-width: 20px; height: 20px; font-size: 11px; }
  .rail .dropdown { position: fixed; top: calc(54px + env(safe-area-inset-top)); left: 10px; right: auto; bottom: auto; max-width: calc(100vw - 20px); }
  /* Trang chi tiết: ẩn thanh mục ở đáy (như Teams) */
  .shell.show-main:is([data-section=chat], [data-section=activity]) .rail, .shell.m-detail .rail { display: none; }
  .shell.show-main:is([data-section=chat], [data-section=activity]) .page { grid-row: 1 / 4; }

  /* Đầu trang danh sách: ảnh đại diện · tiêu đề lớn · các nút */
  .pane { background: #fff; }
  .pane > .pane-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 8px 12px; }
  .pane > .pane-head h2 { font-size: 25px; font-weight: 700; flex: 1; min-width: 0; margin: 0 0 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pane > .pane-head .spacer { display: none; }
  .pane > .pane-head .icon-btn, .pane > .pane-head .compose { min-width: 40px; height: 40px; font-size: 17px; }
  .pane > .pane-head .icon-btn svg { width: 22px; height: 22px; }
  .m-me { display: flex; border: 0; background: none; padding: 0; cursor: pointer; flex: none; }
  .m-me .avatar { width: 34px; height: 34px; font-size: 12.5px; }
  /* Bộ lọc: nút bo tròn, trượt ngang */
  .pane .chat-side-head { padding: 0; }
  .pane-chips { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 2px 14px 12px; scrollbar-width: none; }
  .pane-chips::-webkit-scrollbar { display: none; }
  .pane-chips .chip { flex: none; border-radius: 18px; padding: 7px 15px; font-size: 14.5px; border-color: #d1d1d1; }
  .pane-body { padding: 0 0 12px; }

  /* Hoạt động */
  .act { gap: 13px; padding: 12px 14px 12px 26px; margin: 0; border-radius: 0; }
  .act:hover, .act.active { background: none; box-shadow: none; }
  .act.is-unread::before { left: 9px; top: 31px; width: 9px; height: 9px; }
  .act-av, .act-av .avatar { width: 48px; height: 48px; font-size: 16px; }
  .act-kind { width: 22px; height: 22px; right: -4px; bottom: -4px; border-color: #fff; }
  .act-kind svg { width: 12px; height: 12px; }
  .act-title { font-size: 16px; }
  .act-time { font-size: 13px; }
  .act-where { font-size: 13px; margin-top: 4px; }

  /* Trò chuyện: danh sách */
  .cs-head { background: #fff; padding: 10px 10px 4px 8px; }
  .cs-name { font-size: 15.5px; }
  .pane .conv { gap: 13px; padding: 10px 14px; margin: 0; border-radius: 0; border: 0; }
  .pane .conv:hover, .pane .conv.active { background: none; box-shadow: none; }
  .pane .conv .avatar { width: 48px; height: 48px; font-size: 16px; }
  .conv-name { font-size: 16.5px; font-weight: 500; }
  .conv.has-unread .conv-name { font-weight: 700; }
  .conv-preview { font-size: 14.5px; }
  .conv-time { font-size: 13px; }
  .conv .unread { min-width: 20px; height: 20px; font-size: 11.5px; }
  .shell[data-section=chat]:not(.show-main) .m-fab { display: flex; position: absolute; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 8;
    align-items: center; gap: 9px; border: 0; border-radius: 28px; padding: 14px 22px; background: var(--accent); color: #fff;
    font: inherit; font-size: 16px; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.24); cursor: pointer; }

  /* Cuộc trò chuyện: đầu trang ‹ ảnh · tên · gọi */
  .chat-main .chat-head, .act-detail-head { gap: 6px; padding: 6px 6px 6px 2px; padding-top: calc(6px + env(safe-area-inset-top) * 0); border-bottom: 1px solid #ececec; background: #fff; overflow: visible; }
  .chat-head .back, .act-detail-head .back { display: inline-flex !important; align-items: center; justify-content: center; width: 42px; height: 42px; flex: none; border: 0; background: none; color: #242424; }
  .chat-main .chat-head .avatar { width: 38px; height: 38px; }
  .chat-main .chat-title { font-size: 17px; font-weight: 600; }
  .chat-main .chat-title-wrap { flex: 1; min-width: 0; }
  .chat-main .chat-head > span[style*="flex:1"] { display: none; }
  .chat-main .chat-tabs, .chat-main .ch-sep, .chat-main #chat-find, .chat-main #chat-people { display: none; }
  .chat-main .ch-btn { width: 42px; height: 42px; }
  .chat-main .ch-btn svg { width: 23px; height: 23px; }
  /* Bong bóng tin nhắn: của mình bên phải nền màu, người khác nền xám */
  .msg-list { padding: 10px 10px 8px; }
  .msg-col { max-width: 82%; }
  .msg-av, .msg-av .avatar { width: 30px; height: 30px; font-size: 11px; }
  .bubble { border-radius: 18px; padding: 8px 14px; font-size: 16px; line-height: 1.4; background: #f0f0f0; border-color: transparent; }
  /* !important: thắng cả quy tắc của giao diện Tối; trừ tin có tệp / ảnh / trích dẫn / đã thu hồi / bình chọn (giữ nền sáng) */
  .msg.mine .bubble:not(:has(.fcard)):not(:has(.msg-quote)):not(:has(.msg-img)):not(.is-deleted):not(.k-poll):not(.k-praise):not(.p-urgent):not(.p-important) {
    background: var(--accent) !important; border-color: transparent !important; color: #fff !important; }
  .msg.mine .bubble a, .msg.mine .bubble .mention { color: #fff; }
  .msg-time { font-size: 12px; }
  /* Thanh cảm xúc / trả lời: giữ ngón tay lên tin nhắn (rê chuột không dùng được trên màn hình cảm ứng) */
  .msg-row:hover .msg-tools, .pc-msg:hover .msg-tools, .oc-msg:hover .msg-tools { display: none; }
  .m-tools-on .msg-tools { display: flex !important; z-index: 9; }
  .m-tools-on .mt-emo { font-size: 20px; padding: 4px 5px; }
  .m-tools-on .mt-btn { width: 36px; height: 36px; }
  /* Ô nhập: một hàng — ô chữ bo tròn + các nút */
  .oc-composer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px; margin: 0 !important; width: auto !important; max-width: none !important;
    border: 0 !important; border-top: 1px solid #ececec !important; border-radius: 0; box-shadow: none !important; background: #fff;
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom)) 10px; }
  .oc-composer > :not(.oc-input):not(.oc-tools) { flex-basis: 100%; }
  .oc-composer > .oc-input { order: 1; flex: 1 1 0; min-width: 0; position: relative; border: 1px solid #d6d6d6; border-radius: 22px; padding: 9px 14px;
    min-height: 42px; max-height: 140px; font-size: 16px; background: #fff; }
  .oc-composer > .oc-tools { order: 2; padding: 0; gap: 0; flex: none; }
  .oc-tools .oc-hint, #oc-fmt-btn, .oc-tools > span[style] { display: none; }
  .oc-tool { width: 38px; height: 42px; }
  .oc-tool svg { width: 22px; height: 22px; }
  /* Kiểu Teams: [+] [ô nhập + cảm xúc] [máy ảnh] [micrô] — có nội dung thì máy ảnh / micrô đổi thành nút Gửi */
  .oc-composer > .oc-tools { display: contents; }
  .oc-tools > .oc-sep, .oc-tools > label.oc-tool, #oc-plus { display: none !important; }
  .oc-tool.oc-m { display: inline-flex; }
  #oc-mplus { order: 0; color: var(--accent); width: 40px; margin-right: 4px; }
  #oc-mplus svg { width: 30px; height: 30px; }
  .oc-composer > .oc-input { padding-right: 42px; }
  #oc-emoji-btn { order: 2; margin-left: -42px; position: relative; z-index: 1; color: #707070; }
  #oc-mcam { order: 3; margin-left: 2px; }
  #oc-mmic { order: 4; }
  #o-send { order: 5; display: none; }
  .oc-composer.has-content #oc-mcam, .oc-composer.has-content #oc-mmic { display: none; }
  .oc-composer.has-content #o-send { display: inline-flex; }
  .oc-composer.recording > :not(.oc-rec) { display: none !important; }
  .oc-rec:not([hidden]) { display: flex; align-items: center; gap: 8px; min-height: 42px; }
  .oc-rec .oc-tool { display: inline-flex; }
  .oc-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #d13438; animation: oc-blink 1s infinite; }
  .oc-rec-time { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 600; color: #242424; }
  .oc-rec-txt { color: #616161; font-size: 14px; }
  @keyframes oc-blink { 50% { opacity: .25; } }

  /* Công việc / Ứng dụng / Cài đặt: danh sách toàn màn hình ↔ trang chi tiết */
  .shell:is([data-section=work], [data-section=apps], [data-section=settings]):not(.m-detail) .pane { display: flex !important; grid-row: 1 / 3; border: 0; }
  .shell:is([data-section=work], [data-section=apps], [data-section=settings]):not(.m-detail) .page { display: none !important; }
  .shell:is([data-section=work], [data-section=settings]) .pane-head { display: flex !important; }
  .shell:is([data-section=work], [data-section=settings]) .pane-body { display: block !important; overflow-y: auto; padding: 0 0 12px; }
  .shell[data-section=work] .pane-group, .shell[data-section=settings] .set-group { display: flex !important; }
  .shell[data-section=settings] .set-foot { display: block !important; }
  .shell.m-detail .pane { display: none !important; }
  .shell.m-detail .page { display: block !important; grid-row: 2 / 4; }
  .shell.m-detail .page.flush { display: flex !important; }
  .shell.m-detail .m-crumb { display: flex; grid-column: 1; grid-row: 1; }
  .m-crumb { align-items: center; gap: 10px; min-width: 0; padding: 6px 12px 6px 2px; background: #fff; border-bottom: 1px solid #ececec; }
  .m-crumb-back { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex: none; border: 0; background: none; color: #242424; cursor: pointer; }
  .m-crumb .team-badge { width: 36px !important; height: 36px !important; font-size: 13px !important; border-radius: 9px; flex: none; }
  .m-crumb .app-ico, .m-crumb .chan-ico, .m-crumb-ico { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
  .m-crumb-ico svg { width: 22px; height: 22px; color: var(--accent); }
  .m-crumb-txt { min-width: 0; flex: 1; line-height: 1.25; }
  .m-crumb-txt b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-crumb-txt small { display: block; font-size: 13px; color: #616161; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chan-head { display: none; }   /* tên kênh đã ở đầu trang chi tiết */
  /* Danh sách Nhóm › Kênh (như mục Kênh của Teams) */
  .team-tree .team-row { gap: 12px; padding: 10px 10px 10px 6px; border-radius: 0; }
  .team-tree .team-row .team-badge { width: 42px !important; height: 42px !important; font-size: 15px !important; border-radius: 10px; }
  .team-tree .team-name { font-size: 16.5px; font-weight: 500; }
  .team-tree .team-row .tree-more { display: inline-flex; margin-left: auto; }
  .team-tree:not(.apps-tree) .team-channels .chan { padding: 12px 12px 12px 80px; font-size: 16px; color: #424242; }
  .team-tree:not(.apps-tree) .team-channels .chan-ico { display: none; }
  .team-tree .chan.active, .team-tree .chan:hover { background: none; box-shadow: none; }
  .apps-tree .chan { padding: 10px 12px 10px 44px; font-size: 15.5px; gap: 12px; }
  .apps-tree .chan .app-ico { width: 32px !important; height: 32px !important; }
  /* Danh sách Cài đặt */
  .shell[data-section=settings] .set-item, .shell[data-section=work] .pane-item { white-space: normal; padding: 13px 16px; font-size: 16px; border-radius: 0; margin: 0; gap: 14px; }
  .shell[data-section=settings] .set-item.active { background: none; box-shadow: none; }
  .shell[data-section=settings] .set-search { padding: 0 14px 8px; }
  /* Trang Cài đặt: gọn, cân đối với màn hình điện thoại */
  .shell.m-detail .set-title { display: none; }   /* tên trang đã ở đầu trang chi tiết */
  .page h2 { font-size: 17px; }
  .set-section { margin: 14px 0 8px 2px; }
  .set-card { padding: 12px 12px 14px; margin-bottom: 10px; border-radius: 8px; }
  .set-card-head { gap: 10px; margin-bottom: 8px; }
  .set-card-title { font-size: 14.5px; }
  .set-row { padding: 8px 0; font-size: 14px; }
  .dv-meter { flex: none; width: 100%; height: 14px; }   /* trong hàng xếp dọc, flex 240px thành chiều cao 240px */
  .set-tile { width: calc(50% - 5px); }
  .pf-hero { gap: 12px; }
  .pf-main { min-width: 0; flex-basis: 100%; }
  .pf-name { font-size: 18px; }
  .pf-photo .avatar { width: 64px !important; height: 64px !important; font-size: 22px !important; }
  .pf-field input, .pf-field select, .pf-status input { width: 100%; min-width: 0; }
  .pf-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .pf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pf-stat { padding: 8px 12px; }
  .pf-stat b { font-size: 20px; }
  .set-card.about { padding: 24px 16px; }
  .set-card.about .wordmark { font-size: 22px; }
  .set-kv code, .set-card code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
  /* Bảng dài (Thành viên, Trường đơn): không bóp chữ — giữ một dòng và vuốt ngang */
  .mem-table th, .mem-table td, .fs-table th, .fs-table td { white-space: nowrap; }

  /* Hộp thoại phủ kín màn hình */
  /* flex-start (không stretch): hộp thoại dài hơn màn hình vẫn có nền trắng tới hết nội dung — stretch làm nội dung tràn ra ngoài nền */
  .modal-backdrop { padding: 0; align-items: flex-start; }
  .modal, .modal.wide, .modal.ve-modal { width: 100%; max-width: 100%; min-height: 100%; border-radius: 0; box-shadow: none; }
  /* Cửa sổ đơn hàng: phủ kín màn hình, thanh trên đứng yên, chỉ phần chi tiết cuộn.
     Trò chuyện của đơn mặc định ẩn; bấm nút trò chuyện → hiện riêng trò chuyện thay cho chi tiết (lớp m-chat) */
  .modal.wide.order-modal { height: calc(100dvh / var(--zoom, 1)); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .order-modal .order-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .order-modal .order-main { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px calc(16px + env(safe-area-inset-bottom)); }
  .order-modal .order-wrap > .order-side { display: none; }
  .order-modal .order-wrap.m-chat > .order-main { display: none; }
  .order-modal .order-wrap.m-chat > .order-side { display: flex; flex: 1; height: auto; min-height: 0; border: 0; border-radius: 0; }
  .order-modal .order-side .oc-head { padding: 10px 14px; }
  .order-modal .order-side .oc-composer { padding-bottom: calc(7px + env(safe-area-inset-bottom)); }
  /* Nội dung đơn gọn lại cho vừa màn hình điện thoại */
  .order-banner { padding: 10px 14px; gap: 10px; border-radius: 8px; }
  .order-banner-icon svg { width: 26px; height: 26px; }
  .order-banner-sub { font-size: 11.5px; overflow-wrap: anywhere; }
  .order-banner-no { font-size: 18px; }
  .order-section { padding: 10px 0 2px; }
  .order-section-title { font-size: 14.5px; margin-bottom: 8px; }
  .order-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; }
  .order-grid .order-field.wide { grid-column: 1 / -1; }
  .order-field { padding: 3px 0 10px; }
  .order-value { font-size: 14px; }
  .order-value input, .order-value select, .order-value textarea { width: 100%; font-size: 16px; }
  .att-zones { gap: 12px; }
  .att-zone-head { flex-wrap: wrap; }
  .att-row { gap: 8px; padding: 6px 2px; }
  .att-btn { visibility: visible; width: 32px; height: 32px; }
  .order-foot { flex-wrap: wrap; row-gap: 8px; }
  .modal-head { padding: 12px 14px; position: sticky; top: 0; background: #fff; z-index: 2; }
  .modal-body { padding: 14px; }
  .modal-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); position: sticky; bottom: 0; background: #fff; flex-wrap: wrap; }
  /* Cửa sổ đơn hàng: thanh công cụ chỉ còn biểu tượng, luôn ở trên cùng */
  .order-modal > .order-top { position: sticky; top: 0; z-index: 3; border-radius: 0; padding: 4px 6px 4px 10px; gap: 2px; }
  .order-modal > .order-top .btn.o-tool { font-size: 0; gap: 0; padding: 8px; }
  .order-modal > .order-top .btn.o-tool svg { width: 19px; height: 19px; }
  .order-modal > .order-top .o-close { margin-left: auto; }
  .toolbar select, .toolbar input { min-width: 0; max-width: 100%; }
  .notif-panel { width: calc(100vw - 16px); }
  /* Trang phần mềm: ảnh nhỏ lại, thẻ không xuống dòng */
  .page .sw-view { padding: 4px 2px 24px; }
  .sw-hero { gap: 12px; }
  .sw-hero .app-ico { width: 52px !important; height: 52px !important; }
  .sw-tabs { overflow-x: auto; }
  .sw-tab { white-space: nowrap; padding: 10px 10px 9px; }
  .dl-panel { left: 8px !important; right: 8px; top: calc(54px + env(safe-area-inset-top)) !important; bottom: auto !important; width: auto; max-width: none; max-height: 75dvh; }
  .client-invite { left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: none; }
}
/* Hướng dẫn cài lên màn hình chính iPhone: biểu tượng nhỏ nằm trong dòng chữ */
.ios-hint .ci-txt small, .apk-upd .ci-txt small { display: block; white-space: normal; overflow: visible; -webkit-line-clamp: unset; }
.ios-hint .ci-txt small svg { width: 15px; height: 15px; vertical-align: -3px; }
.client-steps svg { width: 16px; height: 16px; vertical-align: -3px; }
/* Trong ứng dụng Android: không có cửa sổ riêng, không có bản cài cho máy tính */
html.oft-mobile .chat-head [id$="-pop"], html.oft-mobile #act-pop { display: none; }
