:root {
  --bg: #f4f5f7; --panel: #fff; --text: #1c2330; --muted: #6b7482; --line: #e4e7ec;
  --brand: #f8e44c; --brand-d: #efd62e; --brand-l: #f8f4c5; --brand-ink: #1c2330; --link: #7a6500; /* vàng Weldhome: nền nút/nhãn dùng chữ tối; chữ liên kết dùng --link để đủ độ tương phản */
  --side: #ffffff; --side-t: #4b5565;
  --hot: #d6336c; --warm: #f08c00; --cold: #4c6ef5; --ok: #2f9e44; --bad: #e03131;
  --fb: #1877f2; --tt: #111; --yt: #e62117;
  --r: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#0f131b; --panel:#181e2a; --text:#e8ebf0; --muted:#8c96a6; --line:#283042; --brand-l:#3a3508; --link:#f8e44c; --side:#121722; --side-t:#aab2c0; --tt:#e8ebf0; }
}
* { box-sizing: border-box; }
body { margin:0; font:14px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--text); }
h1,h2,h3 { margin:0; line-height:1.25; }
h1 { font-size:22px; } h2 { font-size:16px; } h3 { font-size:14px; }
button,input,select,textarea { font:inherit; color:inherit; }
a { color:var(--link); }
.muted { color:var(--muted); } .small { font-size:12px; } .right { text-align:right; } .nowrap { white-space:nowrap; }

/* Đăng nhập */
.login { min-height:100vh; display:grid; place-items:center; padding:16px; }
.login-card { width:100%; max-width:380px; background:var(--panel); padding:32px; border-radius:14px; box-shadow:var(--shadow); border:1px solid var(--line); }
.logo { display:flex; align-items:center; gap:10px; font-weight:800; letter-spacing:.5px; font-size:20px; margin-bottom:6px; }
.logo i { width:34px; height:34px; border-radius:9px; background:var(--brand); display:grid; place-items:center; }
.logo svg { width:20px; height:20px; }

/* Bố cục */
.shell { display:grid; grid-template-columns:230px 1fr; min-height:100vh; }
.side { background:var(--side); color:var(--side-t); padding:18px 12px; display:flex; flex-direction:column; gap:4px; position:sticky; top:0; height:100vh; }
.side .logo { color:#fff; padding:0 8px 16px; }
.nav button { all:unset; box-sizing:border-box; display:flex; align-items:center; gap:10px; width:100%; padding:9px 12px; border-radius:8px; cursor:pointer; color:var(--side-t); }
.nav button:hover { background:rgba(255,255,255,.07); color:#fff; }
.nav button.on { background:var(--brand); color:var(--brand-ink); font-weight:700; }
.nav button:focus-visible { outline:2px solid #fff; outline-offset:-2px; }
.nav svg { width:18px; height:18px; flex:none; }
.side .me { margin-top:auto; padding:12px; border-top:1px solid rgba(255,255,255,.1); font-size:13px; }
.side .me b { color:#fff; display:block; }
.side .me button { all:unset; cursor:pointer; color:var(--side-t); font-size:12px; margin-right:12px; text-decoration:underline; }
.main { padding:24px 28px 48px; min-width:0; max-width:1300px; width:100%; }
.head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; flex-wrap:wrap; }
.head .sub { color:var(--muted); margin-top:2px; }

/* Thành phần */
.card { background:var(--panel); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); padding:16px; }
.card > h2 { margin-bottom:12px; display:flex; justify-content:space-between; align-items:center; gap:8px; }
.grid { display:grid; gap:14px; }
.g4 { grid-template-columns:repeat(4,1fr); } .g3 { grid-template-columns:repeat(3,1fr); } .g2 { grid-template-columns:repeat(2,1fr); }
.g21 { grid-template-columns:2fr 1fr; }
.kpi .v { font-size:26px; font-weight:700; margin-top:2px; } .kpi .l { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.4px; }
.btn { border:1px solid var(--line); background:var(--panel); padding:7px 14px; border-radius:8px; cursor:pointer; font-weight:500; }
.btn:hover { border-color:var(--muted); }
.btn.pri { background:var(--brand); border-color:var(--brand-d); color:var(--brand-ink); font-weight:700; } .btn.pri:hover { background:var(--brand-d); }
.btn.danger { color:var(--bad); } .btn.sm { padding:3px 10px; font-size:12px; }
.btn:disabled { opacity:.55; cursor:default; }
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible { outline:2px solid var(--link); outline-offset:1px; }
.field { display:flex; flex-direction:column; gap:4px; margin-bottom:12px; }
.field label { font-size:12px; color:var(--muted); font-weight:600; }
input,select,textarea { width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
textarea { resize:vertical; min-height:70px; }
.row2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.bar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.bar input[type=search] { max-width:280px; } .bar select { width:auto; }

table { width:100%; border-collapse:collapse; }
th { text-align:left; font-size:12px; color:var(--muted); font-weight:600; padding:8px 10px; border-bottom:1px solid var(--line); text-transform:uppercase; letter-spacing:.3px; }
td { padding:10px; border-bottom:1px solid var(--line); vertical-align:middle; }
tr.click { cursor:pointer; } tr.click:hover td { background:rgba(128,128,128,.07); }
.tw { overflow-x:auto; } .tw table { min-width:760px; }

.pill { display:inline-block; padding:1px 9px; border-radius:99px; font-size:12px; font-weight:600; background:var(--line); }
.pill.hot { background:#ffdeeb; color:var(--hot); } .pill.warm { background:#fff3bf; color:#b36b00; } .pill.cold { background:#dbe4ff; color:var(--cold); }
.pill.won { background:#d3f9d8; color:var(--ok); } .pill.lost { background:#ffe3e3; color:var(--bad); }
.pill.facebook { background:#dce9fe; color:var(--fb); } .pill.tiktok { background:#e9ecef; color:#212529; } .pill.youtube { background:#ffe0de; color:var(--yt); }
.score { display:inline-flex; align-items:center; gap:8px; min-width:92px; }
.score .t { width:44px; height:6px; background:var(--line); border-radius:9px; overflow:hidden; } .score .t i { display:block; height:100%; }
.hbar { display:flex; align-items:center; gap:8px; margin:6px 0; font-size:13px; } .hbar .n { width:100px; flex:none; }
.hbar .t { flex:1; height:10px; background:var(--line); border-radius:9px; overflow:hidden; } .hbar .t i { display:block; height:100%; background:var(--brand); border-radius:9px; }
.list > div { padding:9px 0; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; gap:10px; } .list > div:last-child { border:0; }

.tl { border-left:2px solid var(--line); margin-left:6px; padding-left:16px; }
.tl > div { position:relative; padding-bottom:14px; } .tl > div::before { content:""; position:absolute; left:-23px; top:5px; width:10px; height:10px; border-radius:50%; background:var(--brand); }
.reasons { margin:8px 0 0; padding:0; list-style:none; font-size:12.5px; } .reasons li { display:flex; justify-content:space-between; padding:2px 0; }
.pos { color:var(--ok); } .neg { color:var(--bad); }

.platform { border-top:4px solid var(--c); } .platform .name { font-weight:700; } .up { color:var(--ok); } .down { color:var(--bad); }
.notice { margin-top:10px; padding:10px 12px; border-radius:8px; font-size:13px; background:#fff3bf; color:#5c4400; }
.notice.error { background:#ffe3e3; color:#a61e1e; }
.notice .pre { white-space:pre-line; margin-top:4px; }
@media (prefers-color-scheme: dark) { .notice { background:#3b3000; color:#ffe58a; } .notice.error { background:#3d1515; color:#ffb3b3; } }
.na { color:var(--muted); font-weight:500; cursor:help; }
.trend { margin-top:14px; display:flex; flex-direction:column; gap:2px; }
.addchan { margin-bottom:14px; }
[hidden] { display:none !important; }
.badge { margin-left:auto; min-width:20px; padding:0 6px; border-radius:99px; background:var(--bad); color:#fff; font-size:11px; font-weight:700; line-height:18px; text-align:center; }
.pill.kind { background:var(--brand-l); color:var(--link); }
@media (prefers-color-scheme: dark) { .pill.kind { color:#ffb27a; } }
.trow { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); }
.trow:last-child { border:0; }
.card.agenda { border-left:4px solid var(--brand); } .card.alert { border-left:4px solid var(--bad); }
.tl-list > .trow { align-items:flex-start; }
.quick { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.ptabs { display:flex; gap:8px; overflow-x:auto; padding:2px 2px 10px; margin-bottom:4px; }
.ptab { all:unset; box-sizing:border-box; cursor:pointer; flex:none; display:flex; flex-direction:column; gap:1px; padding:8px 14px; border:1px solid var(--line); border-radius:10px; background:var(--panel); min-width:110px; }
.ptab:hover { border-color:var(--muted); } .ptab.on { border-color:var(--brand); background:var(--brand-l); box-shadow:inset 0 -3px 0 var(--brand); }
.ptab:focus-visible { outline:2px solid var(--link); outline-offset:1px; }
.seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.seg button { all:unset; cursor:pointer; padding:7px 12px; background:var(--panel); border-right:1px solid var(--line); }
.seg button:last-child { border-right:0; } .seg button.on { background:var(--brand); color:var(--brand-ink); font-weight:700; }
.seg button:focus-visible { outline:2px solid var(--link); outline-offset:-2px; }
.chart svg { width:100%; height:auto; display:block; } .legend { display:flex; gap:14px; font-size:12px; margin-top:6px; } .legend i { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px; }

.overlay { position:fixed; inset:0; background:rgba(10,14,22,.55); display:grid; place-items:start center; padding:5vh 16px; overflow:auto; z-index:50; }
.modal { background:var(--panel); border-radius:14px; width:100%; max-width:640px; padding:22px; box-shadow:0 20px 50px rgba(0,0,0,.35); }
.modal.wide { max-width:900px; } .modal .mh { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:14px; }
.modal .mf { display:flex; justify-content:flex-end; gap:8px; margin-top:6px; }
.x { all:unset; cursor:pointer; font-size:22px; line-height:1; padding:2px 8px; color:var(--muted); }
.err { background:#ffe3e3; color:#a61e1e; padding:8px 12px; border-radius:8px; margin-bottom:12px; font-size:13px; }
#toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background:#1c2330; color:#fff; padding:9px 18px; border-radius:99px; opacity:0; transition:opacity .2s; pointer-events:none; z-index:99; }
#toast.show { opacity:1; }
.empty { text-align:center; color:var(--muted); padding:28px 0; }
.task { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); } .task input { width:auto; } .task.done .tt { text-decoration:line-through; color:var(--muted); } .task .tt { flex:1; }
.late { color:var(--bad); font-weight:600; }

@media (max-width:900px) {
  .shell { grid-template-columns:1fr; }
  .side { position:static; height:auto; flex-direction:row; flex-wrap:wrap; align-items:center; padding:10px; }
  .side .logo { padding:0 8px 0 0; } .nav { display:flex; flex-wrap:wrap; gap:2px; } .nav button { width:auto; padding:7px 10px; }
  .side .me { margin:0 0 0 auto; border:0; padding:0; }
  .main { padding:16px 14px 40px; }
  .g4,.g3 { grid-template-columns:repeat(2,1fr); } .g21,.g2 { grid-template-columns:1fr; } .row2 { grid-template-columns:1fr; }
}
@media (max-width:480px) { .g4,.g3 { grid-template-columns:1fr; } }

/* ===== Module Khách hàng nâng cấp ===== */
.pill.st-won { background:#d3f9d8; color:var(--ok); } .pill.st-lost { background:#ffe3e3; color:var(--bad); }
.pill.st-new { background:var(--line); } .pill.st-contacted { background:#e7f5ff; color:#1971c2; } .pill.st-needs_identified { background:#e3fafc; color:#0c8599; }
.pill.st-quoted { background:#fff3bf; color:#b36b00; } .pill.st-negotiating { background:#ffe8cc; color:#d9480f; } .pill.st-nurture { background:#e9ecef; color:#495057; }
.pill.ts-upcoming { background:#e7f5ff; color:#1971c2; } .pill.ts-due { background:#fff3bf; color:#b36b00; } .pill.ts-overdue { background:#ffe3e3; color:var(--bad); }
.pill.ts-done { background:#d3f9d8; color:var(--ok); } .pill.ts-cancelled { background:#e9ecef; color:#495057; } .pill.ts-skipped { background:var(--line); color:var(--muted); }
.pill[class*="rs-"] { background:var(--brand-l); color:var(--link); }
@media (prefers-color-scheme: dark) {
  .pill.st-contacted, .pill.ts-upcoming { background:#12304a; color:#74c0fc; } .pill.st-needs_identified { background:#0f3a3f; color:#66d9e8; }
  .pill.st-quoted, .pill.ts-due { background:#3b3000; color:#ffe58a; } .pill.st-negotiating { background:#3d2410; color:#ffc078; } .pill.st-nurture, .pill.ts-cancelled { background:#2b3140; color:#adb5bd; }
  .pill.st-won, .pill.ts-done { background:#12351b; color:#8ce99a; } .pill.st-lost, .pill.ts-overdue { background:#3d1515; color:#ffa8a8; } .pill[class*="rs-"] { color:#ffb27a; }
}
.tw table.ctable { min-width:1180px; } .ctable td { vertical-align:top; }
.acts { display:flex; gap:5px; flex-wrap:wrap; } .acts .btn { text-decoration:none; display:inline-block; }
a.btn { text-decoration:none; color:inherit; display:inline-block; }
.prio { display:inline-block; font-size:11.5px; font-weight:600; padding:0 8px; border-radius:99px; margin-top:3px; }
.prio.p1 { background:#ffdeeb; color:var(--hot); } .prio.p2 { background:#fff3bf; color:#b36b00; } .prio.p3 { background:#e3fafc; color:#0c8599; } .prio.p4 { background:#ffe3e3; color:var(--bad); } .prio.p5 { background:#e7f5ff; color:#1971c2; }

.drawer-ov { position:fixed; inset:0; background:rgba(10,14,22,.45); z-index:40; display:flex; justify-content:flex-end; }
.drawer { background:var(--bg); width:min(780px,100%); height:100%; overflow:auto; padding:20px 22px 40px; box-shadow:-12px 0 40px rgba(0,0,0,.3); position:relative; animation:slidein .18s ease-out; }
@keyframes slidein { from { transform:translateX(30px); opacity:.5; } to { transform:none; opacity:1; } }
.drawer-x { position:absolute; right:10px; top:8px; font-size:26px; }
.dhead { margin-bottom:12px; padding-right:30px; } .dacts { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.dsec { background:var(--panel); border:1px solid var(--line); border-radius:var(--r); padding:14px 16px; margin-bottom:12px; }
.dsec > h3, .dh h3 { font-size:14px; margin-bottom:10px; } .dh { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; } .dh h3 { margin:0; }
.dsec h4 { margin:12px 0 6px; font-size:13px; }
.kvs > div { min-width:0; word-break:break-word; }
.nextbox { margin:10px 0; padding:10px 12px; border-radius:8px; background:var(--brand-l); } .nextbox.late { background:#ffe3e3; }
.mtable { font-size:13px; } .mtable th, .mtable td { padding:6px 8px; }
.chg { margin:8px 0 0; padding-left:18px; font-size:13px; } .chg li { margin-bottom:6px; }
.tl .sys { padding-bottom:6px; } .tl .sys::before { background:var(--line); }
details > summary { cursor:pointer; color:var(--link); }
fieldset.grp { border:1px solid var(--line); border-radius:var(--r); padding:10px 14px 2px; margin:0 0 14px; }
fieldset.grp legend { font-weight:700; padding:0 6px; font-size:13px; }
label.chk { display:flex; gap:8px; align-items:center; font-weight:600; margin-bottom:4px; } label.chk input { width:auto; }

.attn { border:1px solid var(--line); border-radius:var(--r); padding:10px 12px; min-width:0; } .attn.warn { border-color:var(--bad); }
.attn .ah { display:flex; justify-content:space-between; gap:8px; align-items:flex-start; margin-bottom:6px; font-size:13px; }
.cnt { background:var(--brand); color:var(--brand-ink); border-radius:99px; padding:0 9px; font-weight:700; font-size:12px; min-width:24px; text-align:center; } .cnt.zero { background:var(--line); color:var(--muted); }
.seg button b { margin-left:4px; opacity:.85; }

.tw table.rtable { min-width:1100px; font-size:13px; } .tw table.mtable { min-width:0; } .rtable th { white-space:normal; vertical-align:bottom; }
.rtable .grpth { text-align:center; background:rgba(128,128,128,.08); border-left:2px solid var(--line); } .rtable .sep { border-left:2px solid var(--line); }
.rnotes { margin:10px 0 0; padding-left:18px; color:var(--muted); font-size:12.5px; } .rnotes li { margin-bottom:3px; }
@media (max-width:900px) { .drawer { padding:16px 14px 40px; } }

/* ===== Kết nối Facebook ===== */
.fbcard h2 { margin-bottom:10px; } .fblogo { display:inline-grid; place-items:center; width:22px; height:22px; border-radius:6px; background:#1877f2; color:#fff; font-weight:800; font-family:Georgia,serif; margin-right:4px; }
.fbbtn { background:#1877f2; border-color:#1877f2; color:#fff; padding:9px 20px; font-weight:600; } .fbbtn:hover { background:#1465d1; border-color:#1465d1; }
.fbconn { border:1px solid var(--line); border-radius:var(--r); padding:12px 14px; margin-bottom:10px; } .fbconn .notice { margin:10px 0; }
.fbsteps { margin:8px 0 8px 18px; padding:0; } .fbsteps li { margin-bottom:8px; }
code, .fbcopy { font-family:ui-monospace,Consolas,monospace; font-size:12.5px; background:rgba(128,128,128,.14); padding:1px 5px; border-radius:4px; } .fbcopy { display:inline-block; padding:4px 8px; margin-top:4px; user-select:all; word-break:break-all; }
.fbtrack { display:inline-flex; gap:6px; align-items:center; flex-wrap:wrap; } .okmsg { background:#d3f9d8; color:#1b6b2a; padding:8px 12px; border-radius:8px; margin-bottom:12px; font-size:13px; }
@media (prefers-color-scheme: dark) { .okmsg { background:#12351b; color:#8ce99a; } }

.cnbtn { padding:9px 20px; font-weight:600; } .cnbtn:hover { filter:brightness(.9); }

/* Phân chia khách hàng */
.chips { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.chip { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border:1px solid var(--line); border-radius:99px; background:var(--panel); cursor:pointer; font-size:13px; }
.chip input { margin:0; }
.pill.lost { background:#ffe3e3; color:#a61e1e; }

/* Phân trang, đổi mức tiềm năng */
.pager { display:flex; justify-content:space-between; align-items:center; padding:10px 8px 4px; gap:8px; flex-wrap:wrap; }
select.pot-sel { margin-top:4px; padding:2px 6px; font-size:12px; width:auto; max-width:130px; }

/* ===== Giao diện v3: chuyên nghiệp, sáng, nhấn vàng (ghi đè phần trên) ===== */
:root { --r:14px; --shadow:0 1px 2px rgba(16,24,40,.04), 0 4px 14px rgba(16,24,40,.06); --line:#e9ecf1; --bg:#f6f7fa; }
@media (prefers-color-scheme: dark) { :root { --line:#283042; --bg:#0f131b; --shadow:0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25); } }
body { font-family:"Segoe UI",Inter,system-ui,-apple-system,Roboto,sans-serif; font-size:14px; -webkit-font-smoothing:antialiased; }
h1 { font-size:24px; font-weight:700; letter-spacing:-.2px; } h2 { font-size:16px; font-weight:700; }

/* Khung: thanh bên + thanh trên */
.shell { grid-template-columns:240px 1fr; }
.side { padding:0 0 14px; gap:0; border-right:1px solid var(--line); background:var(--side); box-shadow:none; }
.side .logo { margin:0; padding:20px 20px; background:var(--brand); color:var(--brand-ink); font-size:19px; font-weight:900; letter-spacing:.6px; }
.side .logo i { background:var(--brand-ink); width:32px; height:32px; border-radius:9px; }
.side .logo i svg { stroke:var(--brand); }
.nav { padding:14px 12px; display:flex; flex-direction:column; gap:2px; }
.nav button { padding:11px 14px; border-radius:10px; font-weight:500; color:var(--side-t); position:relative; }
.nav button:hover { background:rgba(128,128,128,.1); color:var(--text); }
.nav button.on { background:var(--brand-l); color:var(--text); font-weight:700; }
.nav button.on::before { content:""; position:absolute; left:-12px; top:8px; bottom:8px; width:4px; border-radius:0 4px 4px 0; background:var(--brand-d); }
.nav button:focus-visible { outline:2px solid var(--link); }
.side-foot { margin-top:auto; padding:16px 22px 6px; font-size:12px; color:var(--muted); line-height:1.5; border-top:3px solid transparent; position:relative; }
.side-foot::after { content:""; display:block; width:34px; height:3px; border-radius:3px; background:var(--brand); margin-top:10px; }
.content { min-width:0; display:flex; flex-direction:column; min-height:100vh; }
.topbar { display:flex; align-items:center; gap:14px; padding:12px 28px; background:var(--panel); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:20; }
.tb-title { flex:1; }
.bell { all:unset; cursor:pointer; position:relative; width:40px; height:40px; border-radius:12px; display:grid; place-items:center; color:var(--side-t); }
.bell:hover { background:rgba(128,128,128,.12); } .bell:focus-visible { outline:2px solid var(--link); }
.bell svg { width:22px; height:22px; } .bell .badge { position:absolute; top:3px; right:1px; margin:0; min-width:18px; line-height:18px; font-size:10.5px; padding:0 5px; }
.umenu { position:relative; }
.uchip { all:unset; cursor:pointer; display:flex; align-items:center; gap:10px; padding:4px 8px 4px 4px; border-radius:12px; }
.uchip:hover { background:rgba(128,128,128,.12); } .uchip:focus-visible { outline:2px solid var(--link); }
.av { width:38px; height:38px; border-radius:50%; background:var(--brand); color:var(--brand-ink); display:grid; place-items:center; font-weight:800; font-size:16px; }
.un { display:flex; flex-direction:column; line-height:1.25; text-align:left; } .un b { font-size:13.5px; } .un small { color:var(--muted); font-size:12px; }
.uchip > svg { width:16px; height:16px; color:var(--muted); }
.udrop { position:absolute; right:0; top:calc(100% + 6px); min-width:210px; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 32px rgba(16,24,40,.18); padding:6px; z-index:30; }
.udrop button { all:unset; box-sizing:border-box; display:block; width:100%; padding:9px 12px; border-radius:8px; cursor:pointer; font-size:13.5px; }
.udrop button:hover { background:rgba(128,128,128,.12); } .udrop button:last-child { color:var(--bad); }
.main { padding:26px 28px 56px; max-width:1360px; margin:0 auto; width:100%; }
.head { margin-bottom:20px; } .head .sub { font-size:13.5px; }

/* Thành phần */
.card { border-radius:var(--r); box-shadow:var(--shadow); padding:18px 20px; border:1px solid var(--line); }
.kpi .v { font-size:28px; font-weight:800; letter-spacing:-.3px; }
.btn { border-radius:10px; padding:8px 16px; font-weight:600; border:1px solid var(--line); background:var(--panel); transition:background .12s,border-color .12s,box-shadow .12s; }
.btn:hover { border-color:#c9ced8; background:rgba(128,128,128,.06); }
.btn.pri { background:var(--brand); border-color:var(--brand); color:var(--brand-ink); font-weight:700; box-shadow:0 1px 2px rgba(170,140,0,.25); }
.btn.pri:hover { background:var(--brand-d); border-color:var(--brand-d); }
.btn.sm { padding:4px 11px; border-radius:8px; }
.btn.danger { color:var(--bad); } .btn.danger:hover { background:#fff0f0; border-color:#f3b4b4; }
@media (prefers-color-scheme: dark) { .btn.danger:hover { background:#3d1515; } }
input,select,textarea { border-radius:10px; padding:9px 12px; border:1px solid #d9dee7; transition:border-color .12s,box-shadow .12s; }
@media (prefers-color-scheme: dark) { input,select,textarea { border-color:var(--line); } }
input:focus,select:focus,textarea:focus { outline:none; border-color:var(--brand-d); box-shadow:0 0 0 3px rgba(248,228,76,.5); }
input[type=checkbox],input[type=radio] { width:auto; accent-color:var(--brand-d); }
.seg { border-radius:10px; background:var(--panel); } .seg button { padding:8px 14px; font-weight:500; } .seg button.on { background:var(--brand); }
th { background:rgba(128,128,128,.06); font-size:11.5px; letter-spacing:.5px; padding:10px 12px; border-bottom:1px solid var(--line); }
th:first-child { border-top-left-radius:10px; } th:last-child { border-top-right-radius:10px; }
td { padding:12px; border-bottom:1px solid var(--line); }
tr:last-child td { border-bottom:0; }
tr.click:hover td { background:var(--brand-l); }
.pill { padding:2px 10px; font-weight:600; }
.cnt { background:var(--brand); } .tl > div::before { background:var(--brand-d); }
.ptab.on { border-color:var(--brand-d); box-shadow:inset 0 -3px 0 var(--brand-d); }
.card.agenda { border-left-color:var(--brand-d); }
.modal { border-radius:18px; padding:24px 26px; } .modal .mh h2 { font-size:18px; }
.drawer { background:var(--bg); }
.dsec { border-radius:var(--r); box-shadow:var(--shadow); }
.tw table.ctable { min-width:900px; }
.notice { border-radius:10px; }

/* Đăng nhập */
.login { background:radial-gradient(1200px 500px at 10% -10%, var(--brand-l), transparent 60%), var(--bg); }
.login-card { max-width:400px; padding:0 0 28px; overflow:hidden; border-radius:20px; box-shadow:0 18px 50px rgba(16,24,40,.12); }
.login-card .logo { margin:0 0 22px; padding:24px 32px; background:var(--brand); color:var(--brand-ink); font-size:22px; font-weight:900; letter-spacing:.6px; }
.login-card .logo i { background:var(--brand-ink); } .login-card .logo i svg { stroke:var(--brand); }
.login-card > :not(.logo) { margin-left:32px; margin-right:32px; }
.login-card > .btn { width:calc(100% - 64px) !important; }

@media (max-width:900px) {
  .shell { grid-template-columns:1fr; }
  .side { position:static; height:auto; flex-direction:column; align-items:stretch; padding:0; border-right:0; border-bottom:1px solid var(--line); }
  .side .logo { padding:12px 16px; font-size:17px; } .side-foot { display:none; }
  .nav { flex-direction:row; flex-wrap:nowrap; overflow-x:auto; padding:8px 10px; gap:4px; }
  .nav button { width:auto; flex:none; padding:8px 12px; } .nav button.on::before { display:none; }
  .topbar { padding:8px 14px; position:static; } .un { display:none; }
  .main { padding:18px 14px 40px; }
}
.grid > *, .card, .main, .dsec { min-width:0; }
.card { overflow-wrap:anywhere; }
.card.tw, .card .tw { overflow-wrap:normal; }

/* ===== Tinh gọn v3.1: màu đỏ chỉ cho quá hạn; nhãn nóng/ấm/lạnh dịu; bảng khách hàng gọn ===== */
:root { --hot:#c2570c; --warm:#a68a00; --cold:#6b7a99; }
.pill.hot { background:#ffe9d2; color:#9a4a00; } .pill.warm { background:#fff6c4; color:#7a6500; } .pill.cold { background:#e9eef7; color:#51607a; }
@media (prefers-color-scheme: dark) { .pill.hot { background:#3d2410; color:#ffc078; } .pill.warm { background:#3b3300; color:#ffe58a; } .pill.cold { background:#222b3d; color:#a9b6d3; } }
.btn.danger { color:var(--text); } .btn.danger:hover { color:var(--bad); background:#fff0f0; border-color:#f3b4b4; }
.ctable td { vertical-align:middle; white-space:nowrap; padding:10px 12px; }
.ctable td:first-child { white-space:normal; min-width:190px; max-width:280px; }
.ctable .acts { flex-wrap:nowrap; gap:4px; }
.ctable .acts .btn.sm { padding:4px 9px; }
.tw table.ctable { min-width:980px; }
.score { min-width:0; gap:6px; } .score .t { width:34px; }
details.card > summary { cursor:pointer; list-style:none; color:var(--text); display:flex; align-items:center; gap:8px; }
details.card > summary::before { content:"▸"; color:var(--muted); transition:transform .15s; } details.card[open] > summary::before { transform:rotate(90deg); }
details.card .card { box-shadow:none; border:0; padding:0; }
.task { padding:12px 0; } .task:last-child, .trow:last-child { border-bottom:0; }
.card > h2 { margin-bottom:8px; }
.empty { padding:22px 0; }
@media (max-width:700px) { .task { flex-wrap:wrap; } .task .tt { flex-basis:100%; } .head .btn { flex:none; } }
.login-card > :not(.logo) { margin-left:32px !important; margin-right:32px !important; }
.login-card > label.chip { width:auto; align-self:flex-start; border:0; background:none; padding:0; }

/* Mạng xã hội gọn */
.strip { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:9px 14px; margin:12px 0 0; background:var(--panel); border:1px solid var(--line); border-radius:12px; font-size:13px; }
.strip.warn { background:var(--brand-l); border-color:transparent; justify-content:space-between; }
.colhead { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding-bottom:8px; border-bottom:1px solid var(--line); }
.card.col, .card.ins, form.addchan { padding:14px 18px; }
.card.col .trow { padding:8px 0; }
.card.ins .list > div { padding:5px 0; font-size:13px; }
details.help { margin-top:6px; } details.help > summary { font-size:12px; color:var(--muted); cursor:pointer; list-style:none; } details.help > summary::before { content:"ⓘ "; }
details.help .muted { margin-top:4px; }
form.addchan { margin-bottom:0; }
#col-card, #ins-card { margin-bottom:0 !important; margin-top:12px !important; }
.trow { flex-wrap:wrap; } .card.col .quick { flex-wrap:wrap; }
form.addchan > div:first-of-type { min-width:0; } form.addchan input, form.addchan select { min-width:0; }
@media (max-width:700px) { form.addchan > div:first-of-type > * { flex:1 1 100% !important; width:auto !important; } .colhead .btn { margin-left:auto; } }
@media (max-width:900px) { .shell { grid-template-columns:minmax(0,1fr); } .content, .main { max-width:100vw; } }
.shell { grid-template-columns:240px minmax(0,1fr); }
@media (max-width:900px) { .shell { grid-template-columns:minmax(0,1fr); } }
@media (max-width:900px) { .side { min-width:0; max-width:100vw; overflow:hidden; } .nav { min-width:0; max-width:100vw; } }
