:root {
  --bg: #f5f7fa; --surface: #fff; --text: #1d2733; --muted: #5b6b7c; --line: #dde3ea;
  --brand: #0b5394; --brand-ink: #fff; --ok: #1e7b45; --warn: #9a6400; --err: #b3261e; --info: #345;
  --radius: 10px; font-family: "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
header.top { background: var(--brand); color: var(--brand-ink); padding: 14px 16px; }
header.top h1 { margin: 0; font-size: 1.15rem; }
header.top p { margin: 2px 0 0; opacity: .85; font-size: .9rem; }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
input[type=text], input[type=password], input[type=search] { flex: 1 1 220px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
button { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: 10px 16px; font-size: .95rem; cursor: pointer; }
button.secondary { background: #e8eef5; color: var(--brand); }
button:disabled { opacity: .5; cursor: not-allowed; }
.muted { color: var(--muted); font-size: .9rem; }
code { overflow-wrap: anywhere; word-break: break-word; }
.notice { background: #fff8e5; border: 1px solid #f0d58c; padding: 10px 12px; border-radius: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f3f7; font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e8eef5; color: var(--info); white-space: nowrap; }
.badge.needs_fix { background: #fff3d6; color: #7a5200; }
.badge.error, .badge.failed { background: #fde7e5; color: var(--err); }
.badge.warning, .badge.needs_review, .badge.unclassified { background: #fff3d6; color: var(--warn); }
.badge.ok, .badge.succeeded, .badge.extracted, .badge.application { background: #e3f4ea; color: var(--ok); }
.badge.result { background: #e4ecfb; color: #1f4e9c; }
.badge.draft { background: #eceff3; color: #445; }
ul.warnings { padding-left: 18px; margin: 6px 0; }
ul.warnings li { margin: 3px 0; }
details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: #fbfcfd; }
details summary { cursor: pointer; font-weight: 600; }
pre.src { white-space: pre-wrap; word-break: break-word; background: #f6f8fa; padding: 8px; border-radius: 6px; font-size: .85rem; margin: 6px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) {
  .grid2 { grid-template-columns: 1fr; }
  main { padding: 12px; }
  th, td { padding: 6px; }
}

/* Chặng 2 — quản trị */
nav.tabs { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px; position: sticky; top: 0; z-index: 5; }
nav.tabs a { padding: 6px 10px; border-radius: 6px; color: var(--brand); text-decoration: none; }
nav.tabs a.active { background: #e8eef5; font-weight: 600; }
nav.tabs .spacer { flex: 1; }
.toast { position: fixed; right: 16px; bottom: 16px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 8px; white-space: pre-line; z-index: 20; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.toast.ok { background: #e3f4ea; color: var(--ok); }
.toast.err { background: #fde7e5; color: var(--err); }
.stack { display: grid; gap: 10px; max-width: 360px; }
label { display: block; font-size: .92rem; }
label input[type=text], label input[type=password], label input[type=date], label input[type=number], label textarea, textarea, select {
  display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; margin-top: 4px; }
.row select { width: auto; display: inline-block; }
.grid2 .span2 { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 8px; }
button.small, .filebtn.small { padding: 4px 8px; font-size: .82rem; }
button.danger { background: var(--err); }
.filebtn { display: inline-block; background: #e8eef5; color: var(--brand); border-radius: 8px; padding: 10px 16px; cursor: pointer; font-size: .95rem; }
.filebtn input { display: none; }
td.acts { white-space: normal; min-width: 180px; }
td.acts button, td.acts .filebtn { margin: 2px 0; }
pre.src.faded { opacity: .7; }
pre.src.diff { font-family: Consolas, monospace; }
.editor { display: grid; gap: 6px; margin-top: 8px; }
.editor input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.pick { max-height: 320px; overflow-y: auto; }
.badge.published, .badge.approved, .badge.confirmed { background: #e3f4ea; color: var(--ok); }
.badge.pending_approval { background: #e4ecfb; color: #1f4e9c; }
.badge.rejected, .badge.withdrawn { background: #fde7e5; color: var(--err); }
.badge.superseded, .badge.unused, .badge.cancelled { background: #eceff3; color: #667; }
.narrow { max-width: 110px; }
.bulkbar { margin-bottom: 8px; }

/* Trình xem cắt biểu mẫu */
.cut-overlay { position: fixed; inset: 0; background: rgba(20, 30, 45, .55); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 12px; }
.cut-dialog { background: var(--surface); border-radius: var(--radius); width: min(980px, 100%); height: min(92vh, 900px); display: flex; flex-direction: column; padding: 14px 16px; gap: 8px; }
.cut-dialog header { display: flex; gap: 8px; align-items: center; } .cut-dialog header button { margin-left: auto; }
.cut-help { margin: 0; font-size: .85rem; color: var(--muted); } .cut-help .cs { color: #0b6b2e; } .cut-help .ce { color: var(--err); }
.cut-tools { gap: 12px; } .cut-tools label { display: flex; gap: 6px; align-items: center; font-size: .9rem; }
.cut-tools input[type=number] { width: 86px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.cut-tools input[type=text] { flex: 0 1 220px; padding: 6px 8px; }
.cut-list { position: relative; flex: 1; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #eef1f5; padding: 10px 14px 40px 56px; }
.cut-row { position: relative; display: flex; gap: 10px; background: #fff; border: 1px solid #e3e8ee; border-top: 0; padding: 5px 10px; cursor: pointer; font-size: .92rem; }
.cut-row:first-of-type { border-top: 1px solid #e3e8ee; }
.cut-row:hover { background: #f6faff; }
.cut-row.sel { background: #e3f1ff; border-left: 4px solid #1f78d1; }

.cut-no { position: absolute; left: -48px; width: 40px; text-align: right; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cut-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cut-meta { color: var(--muted); font-size: .8rem; margin-left: 6px; } .cut-pb { display: block; border-top: 1px dashed #9aa7b5; margin-top: 4px; }
.cut-tag { display: inline-block; background: #ccd3db; color: #34414e; border-radius: 6px; padding: 0 6px; font-size: .75rem; margin-right: 6px; }
.cut-tbl { border-collapse: collapse; font-size: .8rem; } .cut-tbl td { border: 1px solid #cfd6de; padding: 2px 6px; }
.cut-handle { position: absolute; left: 0; right: 0; height: 18px; z-index: 3; cursor: ns-resize; touch-action: none; outline: none; }
.cut-handle::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px; }
.cut-handle.hs::before { background: #0b6b2e; } .cut-handle.he::before { background: var(--err); }
.cut-knob { position: absolute; left: 0; top: 0; padding: 0 8px; height: 18px; line-height: 18px; font-size: .68rem; font-weight: 700; color: #fff; border-radius: 9px; white-space: nowrap; }
.cut-handle.hs .cut-knob { background: #0b6b2e; } .cut-handle.he .cut-knob { background: var(--err); }
.cut-handle:focus-visible .cut-knob, .cut-handle.drag .cut-knob { box-shadow: 0 0 0 3px rgba(31, 120, 209, .45); }
.cut-dialog footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cut-summary { font-size: .9rem; } .cut-summary.bad { color: var(--err); }

/* Xem trước biểu mẫu */
.pv-wrap { flex: 1; overflow: auto; background: #d9dee5; border-radius: 8px; padding: 16px; }
.pv-page { background: #fff; max-width: 794px; margin: 0 auto; padding: 48px 56px; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); font-family: "Times New Roman", Times, serif; font-size: 15px; line-height: 1.45; color: #000; min-height: 400px; overflow-wrap: anywhere; }
.pv-p { margin: 0 0 6px; } .pv-empty { margin: 0; line-height: 1; height: 10px; }
.pv-c { text-align: center; } .pv-r { text-align: right; } .pv-j { text-align: justify; }
.pv-i1 { padding-left: 24px; } .pv-i2 { padding-left: 48px; } .pv-i3 { padding-left: 72px; } .pv-i4 { padding-left: 96px; }
.pv-i5 { padding-left: 120px; } .pv-i6 { padding-left: 144px; } .pv-i7 { padding-left: 168px; } .pv-i8 { padding-left: 192px; }
.pv-no { display: inline-block; min-width: 1.4em; }
.pv-t { width: 100%; border-collapse: collapse; margin: 6px 0; table-layout: auto; }
.pv-t td { padding: 3px 6px; vertical-align: top; }
.pv-t.pv-b td { border: 1px solid #333; }
.pv-t td .pv-p:last-child { margin-bottom: 0; }
.pv-pic { max-width: 100%; height: auto; } .pv-img { color: #777; font-size: .8rem; }
.pv-pb { border: 0; border-top: 1px dashed #999; margin: 12px 0; }
.form-name { min-width: 260px; width: 100%; }

.fields-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.src-pane { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.src-pane .pv-wrap { flex: none; max-height: calc(100vh - 90px); padding: 8px; }
.src-pane .pv-page { padding: 24px 28px; font-size: 14px; min-height: 200px; }
.pv-blk.pv-hit { background: #fff3b0; outline: 2px solid #e0b400; }
@media (max-width: 1000px) { .fields-split { grid-template-columns: 1fr; } .src-pane { position: static; } .src-pane .pv-wrap { max-height: 60vh; } }

/* tô màu đối chiếu trường dữ liệu <-> Word gốc */
.pv-blk.hl { cursor: pointer; border-radius: 3px; }
.fdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
details.field { border-left: 4px solid transparent; padding-left: 6px; }
.pv-blk.hl-0 { background: #e3f0ff; box-shadow: -3px 0 0 #4a90e2; }
details.field.fc-0 { border-left-color: #4a90e2; } details.field.fc-0 .fdot { background: #4a90e2; }
.pv-blk.hl-1 { background: #e6f7e6; box-shadow: -3px 0 0 #4caf50; }
details.field.fc-1 { border-left-color: #4caf50; } details.field.fc-1 .fdot { background: #4caf50; }
.pv-blk.hl-2 { background: #fdebd6; box-shadow: -3px 0 0 #f0932b; }
details.field.fc-2 { border-left-color: #f0932b; } details.field.fc-2 .fdot { background: #f0932b; }
.pv-blk.hl-3 { background: #f3e5f7; box-shadow: -3px 0 0 #a05bc0; }
details.field.fc-3 { border-left-color: #a05bc0; } details.field.fc-3 .fdot { background: #a05bc0; }
.pv-blk.hl-4 { background: #ddf5f3; box-shadow: -3px 0 0 #1fa89b; }
details.field.fc-4 { border-left-color: #1fa89b; } details.field.fc-4 .fdot { background: #1fa89b; }
.pv-blk.hl-5 { background: #fde3e6; box-shadow: -3px 0 0 #e05266; }
details.field.fc-5 { border-left-color: #e05266; } details.field.fc-5 .fdot { background: #e05266; }
.pv-blk.hl-6 { background: #eef3d4; box-shadow: -3px 0 0 #8fa31e; }
details.field.fc-6 { border-left-color: #8fa31e; } details.field.fc-6 .fdot { background: #8fa31e; }
.pv-blk.hl-7 { background: #e6e8f5; box-shadow: -3px 0 0 #5c6bc0; }
details.field.fc-7 { border-left-color: #5c6bc0; } details.field.fc-7 .fdot { background: #5c6bc0; }
details.field.flash { background: #fff8d6; transition: background .3s; }
.pv-blk.pv-hit { background: #fff3b0 !important; }

/* Danh sách thủ tục: thống kê công khai / không công khai */
.tstats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.tgroup { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; border-top-width: 4px; }
.tgroup.pub { border-top-color: var(--ok); }
.tgroup.non { border-top-color: #8a93a3; }
.tgroup h3 { margin: 0 0 2px; font-size: 1rem; }
.tgroup h3 b { font-size: 1.3rem; margin-left: 6px; }
.tgroup p { margin: 0 0 8px; font-size: .85rem; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { display: inline-flex; gap: 6px; align-items: center; background: #f3f5f8; color: inherit; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .85rem; cursor: pointer; }
.tchip b { font-weight: 700; }
.tchip.on { background: var(--info); color: #fff; border-color: var(--info); }
@media (max-width: 760px) { .tstats { grid-template-columns: 1fr; } }

/* Biểu mẫu tách riêng: viền sọc bên phải vùng Word gốc + chấm màu ở bảng biểu mẫu */
.pv-blk.fm { border-right: 5px solid var(--fmc, #888); background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgba(0,0,0,.045) 7px 9px); cursor: pointer; }
.pv-blk.fm-0, .mdot.fm-0 { --fmc: #c0392b; } .pv-blk.fm-1, .mdot.fm-1 { --fmc: #2471a3; } .pv-blk.fm-2, .mdot.fm-2 { --fmc: #b9770e; }
.pv-blk.fm-3, .mdot.fm-3 { --fmc: #17806d; } .pv-blk.fm-4, .mdot.fm-4 { --fmc: #7d3c98; } .pv-blk.fm-5, .mdot.fm-5 { --fmc: #5d6d7e; }
.mdot { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: var(--fmc, #888); }
tr.flash { background: #fff8d6; transition: background .3s; }

/* Danh sách thả xuống (Thành phần hồ sơ) + tô vàng */
mark.hl-y { background: #fff176; color: inherit; padding: 0 2px; border-radius: 3px; }
.dsr-list { display: flex; flex-direction: column; gap: 8px; }
.dsr-tools { display: flex; gap: 8px; }
details.dsr { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
details.dsr > summary { cursor: pointer; padding: 8px 12px; font-weight: 600; }
details.dsr-l2 > summary { font-weight: 500; }
details.dsr[open] > summary { border-bottom: 1px solid var(--line); background: #f3f7fc; border-radius: 8px 8px 0 0; }
.dsr-body { padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.dsr-body details.dsr { margin-left: 8px; }
.dsr-line { margin: 0; line-height: 1.5; }
.lay-list { flex: 1; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #eef1f5; padding: 8px; }
.lay-row { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid #e3e8ee; border-top: 0; padding: 5px 10px; font-size: .92rem; }
.lay-row:first-child { border-top: 1px solid #e3e8ee; }
.lay-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lay-btns { display: flex; gap: 4px; flex: none; }
.lay-btns button.on { background: var(--info); color: #fff; border-color: var(--info); }
.lay-row.lay-h1 { border-left: 5px solid #1f78d1; background: #e3f1ff; font-weight: 700; }
.lay-row.lay-h2 { border-left: 5px solid #7fb4e8; margin-left: 24px; background: #f0f7ff; font-weight: 600; }
.lay-row.lay-h3 { border-left: 5px solid #b0d4b0; margin-left: 48px; }
.lay-row.lay-hl .lay-text { background: #fff176; }
.lay-preview { margin-top: 8px; }
.pager { margin-top: 10px; justify-content: space-between; }
.pager label { display: inline-flex; gap: 6px; align-items: center; }
.lk-help { margin: 8px 0 0; padding-left: 20px; font-size: 13px; }
.ai-item { border-top: 1px solid #d9dee7; padding: 10px 0; }
.ai-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-cmp pre, .ai-cmp textarea { width: 100%; box-sizing: border-box; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.ai-ev { font-size: .9rem; }
@media (max-width: 760px) { .ai-cmp { grid-template-columns: 1fr; } }
.cut-dialog.aiv { width: min(1500px, 100%); height: 96vh; }
.aiv header .muted { margin-left: 12px; } .aiv header button { margin-left: auto; }
.aiv-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 2fr) minmax(0, 1.1fr); gap: 12px; }
.aiv-word { min-height: 0; display: flex; flex-direction: column; gap: 6px; } .aiv-word .pv-wrap { flex: 1; min-height: 0; padding: 8px; } .aiv-word .pv-page { padding: 20px 24px; font-size: 13px; }
.aiv-list { overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.aiv-nav { text-align: left; background: transparent; color: inherit; border: 1px solid transparent; font-weight: 400; padding: 6px 8px; }
.aiv-nav.diff { background: #fff6cc; border-left: 4px solid #e0a800; }
.aiv-tag { float: right; font-size: .72rem; background: #e0a800; color: #1a1a1a; border-radius: 8px; padding: 0 6px; }
.aiv-legend { margin: 2px 4px 6px; font-size: .8rem; color: var(--muted); } .aiv-dot { display: inline-block; width: 10px; height: 10px; background: #e0a800; border-radius: 2px; }
.aiv-nav.sel { background: #e3f1ff; border-color: #1f78d1; }
.aiv-main { overflow-y: auto; padding-right: 6px; }
.aiv-main .ai-item { border-top: 0; padding-top: 0; }
.aiv .ai-cmp pre, .aiv .ai-cmp textarea { max-height: 52vh; min-height: 30vh; font-size: .9rem; }
.aiv .ai-cmp textarea { height: 40vh; }
.aiv footer { align-items: center; flex-wrap: wrap; } .aiv-gap { flex: 1; }
@media (max-width: 1100px) { .aiv-body { grid-template-columns: 1fr; overflow-y: auto; } .aiv-list { max-height: 18vh; } .aiv-word .pv-wrap { max-height: 50vh; } }

.df-del { background: #ffd6d6; color: #8a1010; border-radius: 2px; text-decoration: line-through; text-decoration-color: rgba(138, 16, 16, .45); }
.df-add { background: #c9f2cf; color: #0b5a1d; border-radius: 2px; font-weight: 600; }
.df-line-del { display: inline-block; width: 100%; box-sizing: border-box; background: #fff1f1; border-left: 3px solid #e5484d; padding-left: 4px; }
.df-line-add { display: inline-block; width: 100%; box-sizing: border-box; background: #effbf1; border-left: 3px solid #30a46c; padding-left: 4px; }
.aiv-diffnote { margin: 4px 0 8px; font-size: .85rem; } .aiv-diffnote mark { padding: 0 4px; }
.aiv-propbox .small { margin-top: 6px; }

.pkg-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 10px 0; }
.pkg-col { border: 1px dashed #b8c4d4; border-radius: 8px; padding: 10px 12px; background: #fafcff; min-width: 0; }
.pkg-col.has { border-style: solid; border-color: #6fa886; background: #f3faf5; }
.pkg-col h3 { margin: 0 0 4px; font-size: .95rem; }
.pkg-col input[type=file] { width: 100%; margin: 6px 0; }
.pkg-name { word-break: break-all; }
label.inline { display: inline-flex; gap: 6px; align-items: flex-start; font-weight: normal; }
@media (max-width: 900px) { .pkg-cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .pkg-cols { grid-template-columns: 1fr; } }
.ai-pick{border:1px solid var(--line,#ccc);border-radius:8px;padding:8px 12px;margin:8px 0}
.ai-pick legend{font-size:13px;padding:0 6px}
.ai-pick-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:4px 16px;margin-top:6px}

.chat-thread{display:flex;flex-direction:column;gap:8px;margin:12px 0;max-height:60vh;overflow:auto}
.cm{max-width:80%;padding:8px 12px;border-radius:10px;border:1px solid #d9dee7;background:#fff}
.cm.citizen{align-self:flex-start;background:#f1f5fa}.cm.bot{align-self:flex-start}
.cm.admin{align-self:flex-end;background:#e3f4ea;border-color:#b7dfc6}
.cm.esc{border-color:#e4b0aa;background:#fdf0ee}
.cm-h{font-size:.78rem;color:#64748b;margin-bottom:2px}.cm-b{white-space:pre-wrap;word-break:break-word}
#chatBadge{margin-left:4px}

/* ---- Hộp thư tin nhắn (quản trị) ---- */
.msg-app{display:grid;grid-template-columns:340px minmax(0,1fr);height:calc(100vh - 170px);min-height:480px;background:#fff;border:1px solid #d9dee7;border-radius:10px;overflow:hidden}
.msg-side{display:flex;flex-direction:column;border-right:1px solid #e3e7ee;min-height:0}
.msg-side-h{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid #eef1f5}
.msg-side-h .spacer{flex:1}
.icon-btn{background:transparent;border:0;color:#475569;font-size:1.2rem;line-height:1;padding:4px 8px;border-radius:6px;cursor:pointer}
.icon-btn:hover{background:#eef2f7}
.msg-tools{display:flex;gap:6px;padding:8px 10px;border-bottom:1px solid #eef1f5}
.msg-tools input{flex:1;min-width:0}.msg-tools select{max-width:130px}
.msg-list{flex:1;overflow:auto}.msg-list .pad{padding:14px}
.mc-item{display:flex;gap:10px;width:100%;text-align:left;background:#fff;border:0;border-bottom:1px solid #f1f4f8;border-radius:0;padding:10px 12px;color:inherit;cursor:pointer}
.mc-item:hover{background:#f6f8fb}.mc-item.active{background:#e7f0ff}
.mc-item.waiting strong{color:#b3261e}
.mc-av{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;color:#fff;font-size:.8rem;font-weight:700}
.mc-av.big{width:44px;height:44px}
.mc-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.mc-top{display:flex;justify-content:space-between;gap:8px}.mc-top strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mc-top time{color:#64748b;font-size:.78rem;flex:0 0 auto}
.mc-prev{color:#64748b;font-size:.88rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mc-tags{display:block;margin-top:2px}
.msg-main{display:flex;flex-direction:column;min-width:0;min-height:0;background:#f3f5f9}
.msg-empty{margin:auto;text-align:center;color:#64748b}.msg-empty-ic{font-size:3rem}
.mc-head{display:flex;align-items:center;gap:10px;padding:10px 16px;background:#fff;border-bottom:1px solid #e3e7ee}
.mc-back{display:none}
.mc-title{min-width:0}.mc-sub{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:3px}
.mc-sub select{padding:2px 8px;font-size:.85rem;width:auto}
.mc-chip{background:#eef2f7;color:#475569;border-radius:6px;padding:2px 8px;font-size:.8rem}
.mc-thread{flex:1;overflow:auto;padding:14px 18px;display:flex;flex-direction:column;gap:8px}
.mc-day{display:flex;justify-content:center;margin:10px 0 4px}
.mc-day span{background:#9aa4b2;color:#fff;border-radius:999px;padding:3px 14px;font-size:.78rem;font-weight:600}
.mc-row{display:flex}.mc-row.right{justify-content:flex-end}
.mc-bubble{max-width:min(70%,640px);padding:8px 12px;border-radius:12px;background:#fff;border:1px solid #e1e6ee;word-break:break-word}
.mc-bubble.bot{background:#eef1f6;border-color:#e1e6ee}
.mc-bubble.admin{background:#d6e6ff;border-color:#bcd4fb}
.mc-bubble.esc{border-color:#e4b0aa}
.mc-who{font-size:.74rem;color:#64748b;margin-bottom:2px;font-weight:600}
.mc-text{white-space:pre-wrap}
.mc-flag{margin-top:4px;font-size:.78rem;color:#b3261e;font-weight:600}
.mc-time{margin-top:3px;font-size:.72rem;color:#64748b;text-align:right}
.mc-compose{display:flex;gap:8px;align-items:flex-end;padding:10px 14px;background:#fff;border-top:1px solid #e3e7ee}
.mc-compose textarea{flex:1;resize:none;max-height:140px}
.mc-send{flex:0 0 auto}
@media (max-width:760px){
  .msg-app{grid-template-columns:1fr;height:calc(100vh - 140px)}
  .msg-app[data-open="0"] .msg-main{display:none}
  .msg-app[data-open="1"] .msg-side{display:none}
  .mc-back{display:inline-block}
  .mc-bubble{max-width:88%}
}
