/* Go Tall OS — giao diện nhân viên. Chàm #1F183E · cam #EE4421 · tím #4F2780 · nền #F6F4F4 */
:root {
  --ink: #1F183E;
  --ink-2: #3A3358;
  --accent: #EE4421;
  --accent-h: #D63A19;
  --violet: #4F2780;
  --violet-50: #F1ECF8;
  --bg: #F6F4F4;
  --card: #FFFFFF;
  --line: #E7E2E5;
  --line-2: #D9D3D8;
  --muted: #6D6779;
  --green: #17865A; --green-50: #E5F4EC;
  --yellow: #B98500; --yellow-50: #FFF6D6; --note: #FFF8DB; --note-line: #F1D877;
  --red: #D12F1F; --red-50: #FDECEA;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 24, 62, .06), 0 1px 1px rgba(31, 24, 62, .03);
  --side-w: 224px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 4px 0 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.red { color: var(--red); font-weight: 500; }
.pre { white-space: pre-wrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ---------- nút, ô nhập ---------- */
.btn, .primary, button.tab, .chip-btn, .seg-b, .done-btn, .icon-btn, .ghost-light {
  cursor: pointer; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; padding: 7px 12px; font-weight: 550;
  transition: background .12s, border-color .12s, color .12s; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.block, .primary.block { width: 100%; }
.btn.accent { border-color: var(--accent); color: var(--accent); }
.btn.accent:hover { background: var(--accent); color: #fff; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-h); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.busy { position: relative; color: transparent !important; }
button.busy::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.primary.busy::after { border-color: #fff transparent #fff transparent; }
.icon-btn { padding: 0; width: 34px; height: 34px; font-size: 22px; line-height: 1; border-color: transparent; background: transparent; }
.icon-btn:hover { background: rgba(31, 24, 62, .06); }
.icon-btn.light { color: #fff; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; background: #fff; min-height: 38px;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(79, 39, 128, .14); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.form-err { color: var(--red); font-size: 13px; min-height: 0; }
.form-err:empty { display: none; }

/* ---------- huy hiệu ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #EFEDF2; color: var(--ink-2); white-space: nowrap; }
.flag-green { background: var(--green-50); color: var(--green); }
.flag-yellow { background: var(--yellow-50); color: var(--yellow); }
.flag-red { background: var(--red-50); color: var(--red); }
.stage { background: var(--violet-50); color: var(--violet); }
.stage-lead, .stage-tested { background: #FFF0EB; color: #B8381B; }
.stage-active, .stage-maintenance, .stage-member { background: var(--green-50); color: var(--green); }
.badge.reason { background: #EFEAF7; color: var(--violet); }
.badge.r-red_flag, .badge.r-flag_change { background: var(--red-50); color: var(--red); }
.badge.open { background: #FFF0EB; color: #B8381B; }
.badge.done { background: var(--green-50); color: var(--green); }
.badge.src-pancake { background: #FFF4E5; color: #9A5B00; }
.badge.page { background: #EAF0FB; color: #2B4C8C; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
/* .page (khung trang) trùng tên: reset để chip page không thành hình bầu dục */
.badge.page { display: inline-block; padding: 2px 8px; margin: 0; gap: 0; }
.bot-hint { white-space: nowrap; }
.os-pending { background: var(--yellow-50); color: var(--yellow); }
.os-paid { background: var(--green-50); color: var(--green); }
.os-cancelled { background: #EEE; color: #777; }
.os-refunded { background: var(--red-50); color: var(--red); }
.badge.kind { background: #EFEDF2; }
.badge.esc { background: var(--red-50); color: var(--red); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: #CFCAD3; }
.dot-green { background: #22A86F; }
.dot-yellow { background: #F2B705; }
.dot-red { background: var(--red); }
.ch { font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 2px 5px; border-radius: 4px; color: #fff; background: #8A8496; flex: none; line-height: 1.3; }
.ch-messenger, .ch-facebook { background: #1877F2; }
.ch-zalo { background: #0068FF; background: linear-gradient(135deg, #0068FF, #00A2FF); }
.ch-web { background: var(--violet); }
.sla { font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 999px; background: #EFEDF2; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sla.soon { background: var(--yellow-50); color: var(--yellow); }
.sla.over { background: var(--red); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #EFEDF2; color: var(--ink-2); }
.chip.gap { background: #FFF0EB; color: #B8381B; }
.count { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.count.warn { color: var(--red); }

/* ---------- trạng thái ---------- */
.loading { display: flex; align-items: center; gap: 10px; padding: 24px; color: var(--muted); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty-t { font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.error-box { margin: 12px; padding: 12px 14px; border-radius: 8px; background: var(--red-50); color: var(--red); }
#app.booting { min-height: 100vh; display: grid; place-items: center; }

/* ---------- đăng nhập ---------- */
.login-page { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 460px) 1fr; }
.login-card { background: #fff; padding: 48px 40px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.login-card .logo { color: var(--ink); margin-bottom: 18px; }
.login-card h1 { font-size: 26px; }
.login-art { background: var(--ink); color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 56px; position: relative; overflow: hidden; }
.login-art::before { content: ""; position: absolute; right: -120px; top: -80px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--violet), transparent 70%); opacity: .9; }
.login-art::after { content: ""; position: absolute; right: 80px; top: 120px; width: 8px; height: 46%; border-radius: 4px; background: linear-gradient(to top, var(--accent), transparent); box-shadow: -40px 60px 0 -1px rgba(238,68,33,.55), -80px 120px 0 -2px rgba(238,68,33,.3); }
.art-q { position: relative; font-size: 30px; font-weight: 650; line-height: 1.25; max-width: 520px; }
.art-s { position: relative; margin-top: 14px; color: #CFC8E4; }
.demo-box { margin-top: 8px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 10px; background: #FBFAFA; }
.demo-t { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.demo-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 6px; }
.chip-btn { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 10px; font-size: 12.5px; }
.chip-btn span { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.chip-btn:hover { border-color: var(--accent); }

/* ---------- logo ---------- */
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; letter-spacing: .02em; }
.logo-t { font-size: 16px; }
.logo-t b { margin-left: 4px; font-weight: 500; opacity: .7; }

/* ---------- khung ---------- */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 18px 12px; z-index: 20; }
.side .logo { padding: 0 8px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: #D7D2E6; font-weight: 550; position: relative; }
.nav-a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-a.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-a.active svg { color: var(--accent); }
.nav-s { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; gap: 10px; align-items: center; padding: 8px; }
.me-t { display: flex; flex-direction: column; min-width: 0; }
.me-t b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-t span { font-size: 12px; color: #B9B2CE; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--violet); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 12.5px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.ghost-light { background: transparent; border-color: rgba(255,255,255,.18); color: #D7D2E6; justify-content: flex-start; }
.ghost-light:hover { background: rgba(255,255,255,.08); color: #fff; }
.demo-tag { align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; background: var(--accent); color: #fff; padding: 3px 8px; border-radius: 4px; }
.side .demo-tag { margin-left: 8px; }
.topbar { display: none; }
.main { margin-left: var(--side-w); min-height: 100vh; }
.shell[data-view="inbox"] .main { height: 100vh; overflow: hidden; }

/* ---------- trang chung ---------- */
.page { padding: 24px 28px 40px; max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page.narrow { max-width: 860px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sec { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
button.tab { border: 0; background: transparent; color: var(--muted); padding: 6px 11px; border-radius: 999px; font-size: 13px; }
button.tab:hover { color: var(--ink); background: #EFEDF2; }
button.tab.on { background: var(--ink); color: #fff; }
.list { display: flex; flex-direction: column; }
.li { padding: 8px 0; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; padding-top: 2px; }
.sub-h { font-weight: 650; font-size: 13px; margin-top: 10px; }
.scroll-x { overflow-x: auto; }

/* bảng */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { white-space: nowrap; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.compact td, .tbl.compact th { padding: 5px 8px; }
.tbl th.num { text-align: right; }
.tbl td.act { text-align: right; }
.card > .tbl { margin: 4px 0; }

/* ---------- INBOX ---------- */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 310px; height: 100%; }
.ib-list, .ib-thread, .ib-profile { min-height: 0; min-width: 0; }
.ib-list { display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); }
.ib-list-h { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 16px 8px; gap: 8px; }
.ib-list .tabs { padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.ib-items { overflow-y: auto; flex: 1; }
.ib-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px 10px 16px; border-bottom: 1px solid var(--line); color: var(--ink); position: relative; }
.ib-item:hover { background: #FAF9FA; text-decoration: none; }
.ib-item.sel { background: var(--violet-50); }
.ib-item.sel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--violet); }
.ib-item.over::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: var(--red); }
.ib-r1 { display: flex; align-items: center; gap: 7px; }
.ib-name { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-item.unread .ib-name { font-weight: 750; }
.ib-time { font-size: 12px; color: var(--muted); flex: none; }
.ib-last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-item.unread .ib-last { color: var(--ink); }
.ib-r3 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 20px; }
.ib-asg { font-size: 11.5px; color: var(--muted); }
.unread-n { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }

.ib-thread { display: flex; flex-direction: column; background: var(--bg); }
.ib-thread > .empty { margin: auto; }
.th-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.th-head .back { display: none; }
.th-title { flex: 1; min-width: 180px; }
.th-name { display: flex; align-items: center; gap: 8px; font-size: 15.5px; }
.th-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.th-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.only-mobile { display: none !important; }
.th-window { display: flex; align-items: center; gap: 8px; padding: 6px 16px; font-size: 12.5px; font-weight: 550; border-bottom: 1px solid var(--line); }
.th-window .wdot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.th-window.ok { background: var(--green-50); color: var(--green); }
.th-window.warn { background: var(--yellow-50); color: #8A6400; }
.th-window.closed { background: var(--red-50); color: var(--red); }
.th-window .muted { font-weight: 400; }
.msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.day-sep { text-align: center; margin: 6px 0; }
.day-sep span { font-size: 11.5px; color: var(--muted); background: #ECE8EB; padding: 2px 10px; border-radius: 999px; }
.msg { display: flex; flex-direction: column; max-width: min(560px, 82%); }
.msg-who { font-size: 11.5px; color: var(--muted); margin: 0 4px 2px; font-weight: 550; }
.bubble { padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-t { font-size: 11px; color: var(--muted); margin: 2px 6px 0; }
.msg.in { align-self: flex-start; }
.msg.in .bubble { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.bot { align-self: flex-end; align-items: flex-end; }
.msg.bot .bubble { background: var(--violet-50); color: var(--ink); border: 1px solid #DDD1EE; border-top-right-radius: 4px; }
.msg.bot .msg-who { color: var(--violet); }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.out .bubble { background: var(--ink); color: #fff; border-top-right-radius: 4px; }
.msg.note { align-self: stretch; max-width: none; }
.msg.note .bubble { background: var(--note); border: 1px solid var(--note-line); border-left: 4px solid #E7B500; border-radius: 8px; }
.msg.note .msg-who { color: #8A6400; }
.msg.sys { align-self: center; max-width: 90%; align-items: center; }
.msg.sys .bubble { background: transparent; color: var(--muted); font-size: 12.5px; padding: 2px 8px; text-align: center; }
.msg.sys .msg-who { display: none; }

.composer { background: #fff; border-top: 1px solid var(--line); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.composer.note-mode { background: var(--note); }
.comp-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.comp-hint { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; background: #EFEDF2; border-radius: 8px; padding: 2px; }
.seg-b { border: 0; background: transparent; padding: 5px 11px; font-size: 12.5px; color: var(--muted); }
.seg-b.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.note-mode .seg-b.on { background: #F7D85C; }
.comp-row { display: flex; gap: 8px; align-items: flex-end; }
.comp-row textarea { min-height: 44px; max-height: 180px; }
.note-mode textarea { border-color: var(--note-line); }
.note-mode .primary { background: #E7B500; border-color: #E7B500; color: var(--ink); }

.switch { flex-direction: row; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; }
.sw-in { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.sw { width: 34px; height: 20px; border-radius: 999px; background: #CFCAD3; position: relative; transition: background .15s; flex: none; }
.sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw-in:checked + .sw { background: var(--green); }
.sw-in:checked + .sw::after { transform: translateX(14px); }
.sw-in:focus-visible + .sw { outline: 2px solid var(--violet); outline-offset: 2px; }

.ib-profile { background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pf-head { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.pf-head > div { flex: 1; }
.pf-head .back { display: none; }
.pf-sec { display: flex; flex-direction: column; gap: 6px; }
.pf-parent { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.tel { font-weight: 600; white-space: nowrap; }
.pf-child { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.pf-c-h { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pf-line { font-size: 13px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.assess { background: #FBFAFB; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.assess-h { display: flex; align-items: center; gap: 8px; }
.assess-h .eyebrow { flex: 1; }
.kv3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.kv3 > div { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.kv3 span { font-size: 11px; color: var(--muted); }
.kv3 b { font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(31, 24, 62, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 14px; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(31,24,62,.3); }
.modal.wide { width: min(720px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px 20px; }
.modal-b { padding: 4px 20px 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.price-preview { font-size: 22px; font-weight: 700; color: var(--accent); min-height: 0; }
.price-preview:empty { display: none; }
.order-res { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.qr-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; place-items: center; min-height: 220px; }
.qr { width: 100%; height: auto; display: block; }
.qr-fallback { font-size: 12.5px; color: var(--muted); text-align: center; padding: 12px; }
.order-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.order-code { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.order-amt { font-size: 20px; font-weight: 700; color: var(--accent); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 4px 0; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; box-shadow: 0 6px 20px rgba(31,24,62,.25); transition: opacity .3s, transform .3s; max-width: 90vw; }
.toast-err { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- biểu đồ ---------- */
.gchart { width: 100%; height: auto; display: block; font-family: var(--font); }
.gchart .grid line { stroke: #EEEAED; stroke-width: 1; }
.gchart .grid line.v { stroke: #F3F0F2; }
.gchart .ax { font-size: 10.5px; fill: var(--muted); }
.gchart.mini .ax { font-size: 9.5px; }
.gchart .ax-t { font-size: 10.5px; fill: var(--muted); }
.gchart .band { fill: rgba(79, 39, 128, .06); }
.gchart .pc { fill: none; stroke-width: 1.4; }
.gchart .p50 { stroke: var(--violet); stroke-width: 1.8; }
.gchart .p3, .gchart .p97 { stroke: #A894C6; stroke-dasharray: 4 3; }
.gchart .pc-l { font-size: 10px; fill: var(--violet); font-weight: 600; }
.gchart.mini .pc-l { font-size: 9px; }
.gchart .meas-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.gchart .meas { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.gchart .meas.last { fill: var(--accent); }
.gchart .meas.flag-red { stroke: var(--red); }
.gchart .meas.flag-red.last { fill: var(--red); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--violet); }
.lg.p3 { border-top: 2px dashed #A894C6; }
.lg.me { border-top-color: var(--accent); position: relative; }
.lg.me::after { content: ""; position: absolute; left: 4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- HỒ SƠ 360 ---------- */
.hh-head { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.hh-h1 { display: flex; align-items: center; gap: 8px; }
.hh-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 18px; }
.meta { display: flex; flex-direction: column; min-width: 0; }
.meta span { font-size: 11.5px; color: var(--muted); }
.meta b { font-weight: 550; overflow-wrap: anywhere; }
.person { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pc-badges { display: flex; align-items: center; gap: 8px; }
.big-h { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.pc-chart { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pc-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dose.warn { color: var(--red); }
.dose.warn b { color: var(--red); }
.meas-table summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--violet); }
.meas-table .tbl { margin-top: 6px; }
.mform { border-top: 1px solid var(--line); padding-top: 10px; }
.mrow { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 6px; }
.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.tl li:first-child { border-top: 0; }
.tl-i { width: 26px; height: 26px; border-radius: 50%; background: var(--violet-50); color: var(--violet); display: grid; place-items: center; flex: none; font-size: 13px; }
.tl-case .tl-i { background: #FFF0EB; color: var(--accent); }
.tl-order .tl-i { background: var(--green-50); color: var(--green); }
.back-always { font-size: 26px; }

/* ---------- HÀNG CHỜ ---------- */
.cases { display: flex; flex-direction: column; gap: 14px; }
.case { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); transition: opacity .25s, transform .25s; overflow: hidden; }
.case.over { border-color: #F2B8B0; }
.case.leaving, .task.leaving, .tlist li.done { opacity: 0; transform: translateX(16px); }
.case-l { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.case-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.case-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kv3.tight b { font-size: 14px; }
.ai-sum ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.private-note { border-left: 4px solid var(--accent); background: #FFF4F0; padding: 10px 12px; border-radius: 0 8px 8px 0; }
.pn-l { font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.case-chart { max-width: 420px; }
.case-links { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.case-r { padding: 16px 18px; background: #FBFAFB; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.radios { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.radios legend { font-size: 12.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 4px; padding: 0; }
.radio { flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: #fff; border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; font-weight: 500; }
.radio input { width: auto; min-height: 0; accent-color: var(--accent); margin: 0; }
.radio:has(input:checked) { border-color: var(--accent); background: #FFF4F0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- HÔM NAY ---------- */
.today { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.tgroup { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; border-top: 3px solid var(--violet); }
.g-measure_due { border-top-color: var(--accent); }
.g-flag_changed { border-top-color: var(--red); }
.g-reorder_soon { border-top-color: var(--yellow); }
.g-renewal_soon { border-top-color: var(--green); }
.tg-h { display: flex; justify-content: space-between; align-items: center; }
.cnt { min-width: 26px; height: 26px; border-radius: 13px; background: var(--ink); color: #fff; font-weight: 700; display: grid; place-items: center; padding: 0 8px; font-size: 13px; }
.cnt.zero { background: #EFEDF2; color: var(--muted); }
.tlist { list-style: none; margin: 6px 0 0; padding: 0; }
.tlist li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); transition: opacity .25s, transform .25s; }
.tlist li.none { border-top: 0; }
.ti-main { flex: 1; min-width: 0; }
.ti-name { font-weight: 650; }

/* ---------- VIỆC ---------- */
.tasks { padding: 4px 0; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); transition: opacity .25s, transform .25s; }
.task:first-child { border-top: 0; }
.task.over { background: #FFF8F7; }
.done-btn { width: 30px; height: 30px; padding: 0; border-radius: 50%; color: transparent; border: 2px solid var(--line-2); flex: none; font-size: 15px; }
.done-btn:hover { border-color: var(--green); color: var(--green); background: var(--green-50); }
.task-m { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-t { font-weight: 600; color: var(--ink); }
.task-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }

/* ---------- DASHBOARD ---------- */
.omtm { background: var(--ink); color: #fff; border-radius: 14px; padding: 24px 28px; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; position: relative; overflow: hidden; }
.omtm::after { content: ""; position: absolute; right: -60px; bottom: -120px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(79,39,128,.9), transparent 70%); pointer-events: none; }
.omtm > * { position: relative; z-index: 1; }
.omtm-l { font-size: 14px; color: #D7D2E6; font-weight: 550; }
.omtm-n { font-size: 64px; font-weight: 750; line-height: 1.05; color: #fff; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.omtm-n::after { content: ""; display: block; width: 48px; height: 4px; border-radius: 2px; background: var(--accent); margin-top: 8px; }
.omtm-s { font-size: 12.5px; color: #B9B2CE; margin-top: 8px; max-width: 460px; }
.omtm-side { display: flex; gap: 12px; }
.omtm-side > div { background: rgba(255,255,255,.08); border-radius: 10px; padding: 10px 16px; display: flex; flex-direction: column; min-width: 96px; }
.omtm-side b { font-size: 26px; color: #6BE0A8; }
.omtm-side .bad b { color: #FF9A80; }
.omtm-side span { font-size: 12px; color: #D7D2E6; }
.kpi tr.k-bad td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.kpi tr.k-ok td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.kpi-dot { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.kpi-dot.ok { background: var(--green-50); color: var(--green); }
.kpi-dot.bad { background: var(--red-50); color: var(--red); }
.kpi-dot.na { color: var(--muted); background: #EFEDF2; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fn-row { display: grid; grid-template-columns: 104px minmax(0, 1fr) 48px; gap: 10px; align-items: center; }
.fn-l { font-size: 13px; font-weight: 550; }
.fn-bar-w { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fn-bar { height: 22px; border-radius: 5px; background: linear-gradient(90deg, var(--violet), #7A4FB5); min-width: 4px; }
.fn-row:first-child .fn-bar { background: linear-gradient(90deg, var(--ink), var(--violet)); }
.fn-n { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; }
.fn-d { font-size: 12px; color: var(--red); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 290px minmax(0, 1fr) 270px; }
  .th-actions .btn { padding: 6px 9px; }
}
@media (max-width: 1024px) {
  .pc-body { grid-template-columns: 1fr; }
  .case { grid-template-columns: 1fr; }
  .case-r { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 899px) {
  :root { --top-h: 52px; --nav-h: 62px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-card { padding: 32px 20px; }
  .topbar { display: flex; position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); background: var(--ink); color: #fff; align-items: center; gap: 10px; padding: 0 12px 0 16px; z-index: 30; }
  .topbar .logo-mark { width: 26px; height: 26px; font-size: 11.5px; }
  .top-me { margin-left: auto; display: flex; align-items: center; gap: 6px; }
  .side { inset: auto 0 0 0; width: 100%; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom); flex-direction: row; border-top: 1px solid rgba(255,255,255,.08); }
  .side .logo, .side-foot { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; }
  .nav-a { flex: 1; flex-direction: column; gap: 2px; padding: 8px 2px; font-size: 11px; justify-content: center; border-radius: 0; }
  .nav-a.active { background: transparent; }
  .nav-a.active::before { left: 25%; right: 25%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .nav-l { display: none; }
  .nav-s { display: block; white-space: nowrap; }
  .main { margin-left: 0; padding-top: var(--top-h); padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); min-height: 100dvh; }
  .shell[data-view="inbox"] .main { height: 100dvh; }
  #toasts { bottom: auto; top: calc(var(--top-h) + 10px); }
  .topbar .demo-tag { align-self: center; }
  .page { padding: 16px 16px 32px; gap: 12px; }
  h1 { font-size: 20px; }
  .grid2 { grid-template-columns: 1fr; }

  .inbox { grid-template-columns: 1fr; }
  .inbox[data-pane="list"] .ib-thread, .inbox[data-pane="list"] .ib-profile,
  .inbox[data-pane="thread"] .ib-list, .inbox[data-pane="thread"] .ib-profile,
  .inbox[data-pane="profile"] .ib-list, .inbox[data-pane="profile"] .ib-thread { display: none; }
  .ib-list, .ib-profile { border: 0; }
  .th-head { padding: 8px 10px; gap: 6px; }
  .th-head .back, .pf-head .back { display: inline-flex; }
  .th-title { min-width: 0; flex: 1 1 calc(100% - 50px); }
  .th-actions { width: 100%; }
  .th-actions .btn { flex: 1; padding: 6px 6px; font-size: 12.5px; }
  .only-mobile { display: inline-flex !important; }
  .msgs { padding: 12px; }
  .msg { max-width: 88%; }
  .composer { padding: 8px 10px 10px; }
  .order-res { grid-template-columns: 1fr; justify-items: center; }
  .order-res .order-info { width: 100%; }
  .qr-box { width: 220px; }

  .mrow { grid-template-columns: 1fr 1fr; }
  .mrow button { grid-column: 1 / -1; }
  .radios { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .omtm { padding: 18px 20px; }
  .omtm-n { font-size: 52px; }
  .fn-row { grid-template-columns: 84px minmax(0, 1fr) 40px; gap: 8px; }

  /* bảng → thẻ xếp chồng */
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .rtable tr:last-child { border-bottom: 0; }
  .rtable td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .rtable td.act { justify-content: flex-end; padding-top: 6px; }
  .rtable td.act:empty { display: none; }
  .rtable td > div { text-align: right; }
}
.link-btn { border: 0; background: none; color: var(--violet); padding: 6px 0 0; cursor: pointer; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; }
.ib-profile .kv3 b { font-size: 13.5px; white-space: nowrap; }
.ib-profile .kv3 > div { padding: 5px 7px; }

/* ---------- multi-brand + 9well him ---------- */
.brand-sw { display: flex; flex-direction: column; gap: 4px; padding: 0 8px 16px; font-size: 11px; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: .06em; }
.brand-sel { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 8px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.brand-sel option { color: var(--ink); }
.topbar .brand-sw { flex-direction: row; align-items: center; padding: 0; margin-left: auto; }
.topbar .brand-sw-l { display: none; }
#app[data-brand="9well"] .logo-mark { background: #2B4C8C; }
.urgent-banner { background: var(--red); color: #fff; border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; font-size: 13.5px; line-height: 1.4; }
.urgent-banner b { letter-spacing: .04em; }
.th-urgent .urgent-banner { margin: 8px 12px 0; }
.ib-item.urgent { border-left: 4px solid var(--red); background: var(--red-50); }
.ib-urgent { color: var(--red); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
tr.row-urgent td { background: var(--red-50); }
.nw-trends { display: grid; gap: 12px; }
.nw-trend { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.nw-trend-b { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0; }
.nw-spark path { stroke: var(--violet); }
.nw-spark circle { fill: var(--violet); }
.nw-bars { width: 100%; height: auto; max-height: 160px; }
.nw-bar { fill: #2B4C8C; }
.nw-bar-l { font-size: 9px; fill: var(--muted); }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; margin: 6px 0; }
.chk, label.inline { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.elig-err { color: var(--red); font-size: 13px; }
.elig summary { cursor: pointer; margin-top: 10px; }
.li.plan .sigs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.chk, label.inline { flex-direction: row; font-weight: 400; }
.chk input, label.inline input { width: auto; margin: 0; }
.omtm .seg-b { color: #D7D2E6; }
.omtm .seg-b.on { color: var(--ink); }
.omtm-side .seg { align-self: center; }
.sec > .btn.accent { align-self: flex-start; width: auto; }
.omtm-side > div.seg { flex-direction: row; padding: 2px; min-width: 0; background: rgba(255,255,255,.12); }
[hidden] { display: none !important; }
