:root {
  --navy: #1b2433;          /* màu chữ chính */
  --navy-2: #2b2b40;
  --side: #1e1e2d;          /* nền menu trái */
  --side-2: #11263a;
  --blue: #0079c1;          /* xanh Bảo Việt */
  --blue-d: #00639e;
  --sky: #e8f3fb;
  --paper: #f3f6f9;
  --card: #ffffff;
  --line: #e4e8ee;
  --muted: #6b7686;
  --gold: #e8b10f;
  --red: #d9364f;
  --red-bg: #fdecef;
  --green: #2f9e57;
  --green-bg: #e7f6ec;
  --orange: #d48806;
  --r: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px -1px rgba(16, 24, 40, .06);
  font-family: Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--navy);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); font-size: 14.5px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 16.5px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 10px; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid #7fbfe8; outline-offset: 2px; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.c, th.c, td.c { text-align: center; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.pre { white-space: pre-wrap; }

/* ---------- khung (theo bố cục AD Portal) ---------- */
.shell { display: grid; grid-template-columns: 265px 1fr; min-height: 100vh; }
body.nav-collapsed .shell { grid-template-columns: 0 1fr; }
body.nav-collapsed .nav { transform: translateX(-100%); }
.nav { background: var(--side); color: #fff; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; z-index: 40; transition: transform .2s ease; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.brand { display: block; padding: 14px 18px; background: #1a1a27; text-decoration: none; min-height: 64px; }
.brand-logo { display: flex; flex-direction: column; justify-content: center; min-height: 36px; }
.brand-logo img { max-height: 40px; max-width: 190px; object-fit: contain; object-position: left center; display: block; }
.brand-logo b { font-size: 18px; color: #fff; letter-spacing: .01em; }
.brand-logo span { font-size: 12px; color: #9fb3c8; }
.brand-logo:not(.dark) b { color: var(--navy); }
.brand-logo:not(.dark) img { max-height: 56px; margin: 0 auto; object-position: center; }
.nav-scroll { flex: 1; overflow-y: auto; padding: 14px 10px; background: var(--side-2); scrollbar-width: thin; scrollbar-color: #33475e transparent; }
.menu, .submenu { list-style: none; margin: 0; padding: 0; }
.mi { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; background: none; color: rgba(255,255,255,.72); font: inherit; font-size: 14.5px; text-decoration: none; border-radius: 8px; cursor: pointer; text-align: left; }
.mi:hover { color: #fff; }
.mi.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 500; }
.mi svg { flex: none; opacity: .9; }
.mi .caret { margin-left: auto; display: flex; transition: transform .15s; }
.group.open > .mi .caret { transform: rotate(180deg); }
.submenu { display: none; padding: 2px 0 6px; }
.group.open > .submenu { display: block; }
.mi.sub { padding-left: 44px; font-size: 14px; }
.who { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 14px; background: #1a1a27; border-top: 1px solid rgba(255,255,255,.06); }
.who-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; flex: 1; min-width: 0; }
.who-text { min-width: 0; }
.who-text b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text span { display: block; font-size: 12px; color: #93a4b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .icon-btn { color: #93a4b8; }
.who .icon-btn:hover { color: #fff; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; background: #d8e6f3; color: var(--blue-d); font-weight: 600; text-transform: uppercase; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; background: #fff; padding: 10px 24px 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); min-height: 64px; }
.topbar h1 { font-size: 18px; }
.top-text { min-width: 0; }
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue); }
.crumbs .cur { color: var(--navy); }
.content { min-width: 0; padding: 20px 24px 60px; }
.page-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.scrim { display: none; }
.icon-btn { background: none; border: 0; color: inherit; width: 40px; height: 40px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { background: rgba(0,0,0,.05); }

@media (max-width: 900px) {
  .shell, body.nav-collapsed .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); }
  body.nav-open .nav { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(17, 24, 39, .5); z-index: 30; }
  .topbar { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); min-height: 56px; gap: 8px; }
  .topbar h1 { font-size: 16.5px; }
  .crumbs { font-size: 12px; }
  .content { padding: 14px 12px calc(50px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .nav, .mi .caret { transition: none; } }

/* ---------- nút & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px;
  font: inherit; font-weight: 600; font-size: 14.5px; border-radius: 8px; border: 1px solid var(--blue);
  background: var(--blue); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--blue-d); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: #fff; color: var(--blue); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--blue); background: #fff; }
.btn.danger { background: #fff; color: var(--red); border-color: #E7C2BA; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 20px; width: 42px; height: 42px; border-radius: 8px; cursor: pointer; }
.field { display: grid; gap: 5px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--navy); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; min-height: 42px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
select { height: 42px; padding-top: 0; padding-bottom: 0; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--blue); }
input[type=file] { padding: 8px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--navy); }

.card { background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 12px; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); padding: 32px 20px; text-align: center; }
.empty h2 { margin-bottom: 6px; }
.alert { border-radius: 8px; padding: 10px 14px; font-size: 14px; background: var(--sky); }
.alert.warn { background: #FFF6E0; }
.alert.err { background: var(--red-bg); color: var(--red); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--sky); color: var(--blue-d); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: #ECEFF3; color: var(--muted); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--navy); border-bottom-color: var(--blue); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-weight: 600; padding: 9px 18px; border: 0; background: #fff; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; }

/* ---------- doanh thu cá nhân ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
.chip { font: inherit; font-size: 14px; white-space: nowrap; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 22px 20px; margin-bottom: 14px; }
.hero-name { font-weight: 600; font-size: 15px; }
.hero-code { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.hero-label { color: var(--muted); font-size: 14px; }
.figure { font-size: clamp(34px, 10vw, 56px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; word-break: break-all; }
.figure-rule { width: 64px; height: 5px; background: var(--gold); border-radius: 3px; margin: 12px 0 14px; }
.hero-meta { font-size: 13px; color: var(--muted); }
.kv { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin: 0; display: grid; grid-template-columns: 1fr auto; }
.kv dt, .kv dd { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.kv dt:nth-last-child(2), .kv dd:last-child { border-bottom: 0; }
.note { background: #FFF6E0; border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.content > .narrow, .narrow { max-width: 640px; }

/* ---------- bảng ---------- */
.tbl-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
th { position: sticky; top: 0; background: #EDF1F6; font-weight: 600; font-size: 13px; color: var(--navy-2); z-index: 1; }
th.num, td.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: #F5F8FC; }
tfoot td { position: sticky; bottom: 0; background: #F4F7FB; font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
td.low { color: var(--red); font-weight: 700; }
tr.cancelled td { color: #9AA6B6; text-decoration: line-through; }
.wrap-cell { white-space: normal; min-width: 180px; }

/* ---------- modal ---------- */
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); color: var(--navy); box-shadow: 0 20px 60px rgba(16, 42, 76, .25); }
dialog.modal.wide { width: min(880px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(16, 42, 76, .5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px 20px; }
.modal-body { padding: 8px 20px 16px; overflow: auto; max-height: calc(100vh - 180px); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(440px, calc(100vw - 24px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.err { background: var(--red); }

/* ---------- đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 80% 0%, #3a5a7c 0, transparent 40%), linear-gradient(180deg, #17304d 0%, #1f5d99 100%); }
.login-box { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 32px 28px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); text-align: center; }
.login-box .brand-logo { margin-bottom: 18px; align-items: center; }
.login-box h1 { margin-bottom: 4px; font-size: 26px; font-weight: 500; }
.login-box .org { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.login-box form { display: grid; gap: 14px; text-align: left; }
/* ---------- ảnh ---------- */
.day-group { margin-bottom: 22px; }
.day-group > h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.reports { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.report { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; align-content: start; }
.report .by { font-size: 13px; color: var(--muted); }
.report p { white-space: pre-wrap; margin: 0; font-size: 14px; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs button { padding: 0; border: 0; background: #E8EDF3; border-radius: 6px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pick { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #E8EDF3; }
.pick img { width: 100%; height: 100%; object-fit: cover; }
.pick button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(16, 42, 76, .8); color: #fff; cursor: pointer; }
.lightbox img { width: 100%; height: auto; display: block; border-radius: 8px; }

/* ---------- phiếu kho ---------- */
.voucher-form { max-width: 860px; }
.line-row { display: grid; grid-template-columns: 44px 1fr 110px 130px 42px; grid-template-areas: 'img sel q p x' '. hint hint hint hint'; gap: 8px; align-items: center; }
.line-thumb { grid-area: img; width: 44px; height: 44px; }
.l-sel { grid-area: sel; min-width: 0; } .l-q { grid-area: q; } .l-p { grid-area: p; } .l-x { grid-area: x; padding: 0; }
.line-row .stock-hint { grid-area: hint; font-size: 12.5px; color: var(--muted); margin-top: -4px; }
input[readonly] { background: #F4F6F9; color: var(--muted); }
.v-total { font-weight: 600; }

/* kho: ảnh hàng hoá */
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: block; background: #E8EDF3; flex: none; }
.thumb.xs { width: 34px; height: 34px; border-radius: 6px; }
.thumb.sm { width: 40px; height: 40px; }
.thumb.lg { width: 88px; height: 88px; border-radius: 12px; }
.ph { display: grid; place-items: center; background: var(--sky); color: var(--blue-d); font-weight: 700; font-size: 15px; }
.thumb.lg.ph { font-size: 32px; }
.cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.ph { display: grid; place-items: center; font-size: 40px; color: #8FA9C9; background: linear-gradient(160deg, #EEF3F9, #E1E9F3); }
.goods { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.good { all: unset; box-sizing: border-box; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.good:hover { border-color: var(--blue); }
.good:focus-visible { outline: 3px solid #7FB0E6; outline-offset: 2px; }
.good-img { position: relative; aspect-ratio: 4 / 3; background: #EEF2F7; }
.good-img .badge { position: absolute; left: 8px; top: 8px; }
.good-body { padding: 10px 12px 12px; display: grid; gap: 2px; flex: 1; align-content: start; }
.good-name { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.good-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; font-size: 14px; }
.good-foot b { font-size: 18px; font-variant-numeric: tabular-nums; }
.badge.warn { background: #FFF1CC; color: #8A5A00; }
.txt-red { color: var(--red); } .txt-warn { color: #A86E00; } .txt-green { color: var(--green); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.detail-img { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #EEF2F7; }
.detail-img img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.detail-qty { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.detail-qty span { font-size: 16px; font-weight: 500; color: var(--muted); }
.desc { white-space: pre-wrap; font-size: 14px; background: #F6F8FB; border-radius: 8px; padding: 10px 12px; margin: 0; }
.edit-item { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.img-pick { aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px dashed var(--line); background: #F6F8FB; }
.img-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-pick .ph { font-size: 14px; font-weight: 500; }
.ledger-head { display: flex; gap: 16px; align-items: flex-start; }
/* kho: tổng quan */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile-label { font-size: 13.5px; color: var(--muted); }
.tile-val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile-sub { font-size: 12.5px; color: var(--muted); }
.tile.warn { border-color: #EBC46A; background: #FFFAEB; }
.two-col { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li:hover { background: #F5F8FC; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-track { height: 10px; background: #EDF1F6; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); border-radius: 99px; }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 80px; text-align: right; }
/* kho: kiểm kê */
.count-cell { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.count-in { width: 100px; min-height: 34px; padding: 4px 8px; text-align: right; }
.diff { min-width: 52px; text-align: left; font-weight: 600; font-size: 13px; }
.print-sheet { display: none; }
@media print {
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing { background: #fff; }
  .print-sheet { display: block; color: #000; font-size: 13pt; padding: 10mm; }
  .print-sheet h2 { text-align: center; font-size: 18pt; margin: 8mm 0 2mm; }
  .print-sheet .ps-no { text-align: center; margin-bottom: 6mm; }
  .print-sheet table { margin: 4mm 0 10mm; width: 100%; }
  .print-sheet th, .print-sheet td { border: 1px solid #000; position: static; background: none; color: #000; }
  .ps-sign { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6mm; }
  .ps-sign i { display: block; font-size: 11pt; margin-bottom: 22mm; }
}
@media (max-width: 560px) {
  .card { padding: 14px; }
  .hero { padding: 18px 16px; }
  .line-row { grid-template-columns: 44px 1fr 1fr 42px; grid-template-areas: 'img sel sel x' 'q q p p' 'hint hint hint hint'; }
  .detail, .edit-item { grid-template-columns: 1fr; }
  .edit-item .img-pick { max-width: 220px; }
  .goods { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .good-name { font-size: 13.5px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- nút phụ ---------- */
.btn { border-radius: 6px; }
.btn.warn { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.warn:hover { background: #cf9c08; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 4px; background: #e6f4ff; color: #0958d9; border: 1px solid #b6dcff; margin-top: 3px; }
.em-g { color: var(--green); font-weight: 700; } .em-r { color: var(--red); font-weight: 700; } .em-o { color: var(--orange); font-weight: 700; } .em-b { color: var(--blue); font-weight: 700; }
.inline-sel { width: auto; min-height: 34px; height: 34px; font-size: 14px; font-weight: 500; }

/* ---------- bộ lọc ---------- */
.filters { display: grid; gap: 12px; }
.f-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.note-i { font-style: italic; color: var(--muted); font-size: 12.5px; margin: 0; }
.upd { font-size: 14px; } .upd b { color: var(--green); }

/* ---------- KPI ---------- */
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.kpi { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 14px; text-align: center; display: grid; gap: 4px; align-content: start; }
.kpi-title { font-weight: 700; font-size: 14.5px; }
.kpi-val { font-size: 28px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; color: #4b5563; }
.dash-top { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; }
.dash-top > .card { height: 100%; min-width: 0; }
.mini-kpis + .stack, .card { min-width: 0; }
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #edf0f4; }
.chart .ax { font-size: 11px; fill: #6b7686; font-family: inherit; }
.chart .pt { font-size: 10px; fill: #1b2433; font-weight: 600; font-family: inherit; }
.legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: 12.5px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- bảng kiểu AD ---------- */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r); }
th { background: #f8fafc; color: #1f2937; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid #f0f2f5; }
.tbl-wrap.tall { max-height: 78vh; }
.sum-tbl th, .prog-tbl th { white-space: normal; text-align: center; vertical-align: middle; border-right: 1px solid var(--line); }
.sum-tbl td, .prog-tbl td { border-right: 1px solid #f0f2f5; }
.sum-tbl tr.total td { font-weight: 700; background: #fbfcfe; }
.sum-tbl tbody tr.click { cursor: pointer; }
.sum-tbl tbody tr.click:hover td { background: #f5f9ff; }
.act-tbl td { vertical-align: middle; }
.act-tbl th.sort { cursor: pointer; user-select: none; }
.act-tbl th.sort .sort-i { color: #a0aab8; font-size: 11px; }
.act-tbl th.sort.on .sort-i { color: var(--blue); }
.exp-btn { width: 18px; height: 18px; border: 1px solid #c8cfd9; border-radius: 3px; background: #fff; cursor: pointer; position: relative; padding: 0; }
.exp-btn::before, .exp-btn::after { content: ''; position: absolute; background: #4b5563; left: 4px; right: 4px; top: 8px; height: 1px; }
.exp-btn::after { left: 8px; right: auto; width: 1px; top: 4px; bottom: 4px; height: auto; }
.exp-btn.open::after { display: none; }
.exp-row > td { background: #fafbfd; white-space: normal; padding: 14px 18px; }
.exp-body { display: grid; gap: 8px; font-size: 14px; }
.exp-body .badge { margin-left: 8px; }
.act-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.act-thumbs button { padding: 0; border: 1px solid var(--line); background: #eef2f6; border-radius: 6px; overflow: hidden; width: 110px; height: 140px; cursor: zoom-in; }
.act-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.del-btn { border: 0; background: none; color: #ff4d4f; cursor: pointer; padding: 4px; border-radius: 6px; display: inline-grid; place-items: center; }
.del-btn:hover { background: #fff1f0; }
.switch { width: 44px; height: 22px; border-radius: 11px; border: 0; background: #bfc5cd; position: relative; cursor: pointer; padding: 0; transition: background .15s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.switch.on { background: var(--blue); }
.switch.on i { left: 24px; }
.switch:disabled { cursor: not-allowed; opacity: .6; }
.gallery img { width: 100%; max-height: 72vh; object-fit: contain; background: #111; border-radius: 8px; display: block; margin-bottom: 10px; }

/* ---------- cuộc tư vấn của tôi ---------- */
.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini-kpis > div { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 12px; text-align: center; }
.mini-kpis b { display: block; font-size: 22px; }
.mini-kpis span { font-size: 12.5px; color: var(--muted); }
.act-card { display: flex; gap: 14px; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; align-items: flex-start; }
.act-date { width: 58px; flex: none; text-align: center; border-right: 1px solid var(--line); padding-right: 12px; }
.act-date b { display: block; font-size: 18px; }
.act-date span { font-size: 12.5px; color: var(--muted); }
.act-loc { font-weight: 600; margin-bottom: 4px; }
.act-card .act-thumbs { margin-top: 10px; }
.act-card .act-thumbs button { width: 72px; height: 72px; }
.act-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* ---------- tiến độ kinh doanh ---------- */
.prog-tiles { display: grid; gap: 14px; grid-template-columns: 1fr 2fr 1.1fr; }
.pt { border-radius: var(--r); padding: 18px; display: grid; align-content: center; text-align: center; min-height: 150px; box-shadow: var(--shadow); }
.pt-l { font-size: 13.5px; } .pt-d { font-size: 13px; font-weight: 700; color: var(--green); }
.pt-v { font-size: 30px; font-weight: 700; margin-top: 8px; font-variant-numeric: tabular-nums; }
.pt-v small { font-size: 18px; font-weight: 600; }
.pt-v.sm { font-size: 22px; }
.pt-day { background: #fdf6e3; }
.pt-main { background: linear-gradient(135deg, #1e61f0 0%, #4f8df9 100%); color: #fff; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.pt-sep { width: 1px; height: 70%; background: rgba(255,255,255,.4); }
.pt-side { background: linear-gradient(135deg, #2f6fe8, #4a8cf7); color: #fff; grid-template-columns: 1fr 1fr; gap: 10px; }
.prog-tbl tr.grp td { font-weight: 700; background: #f7f9fc; }

/* ---------- hồ sơ ---------- */
.prof { display: flex; gap: 24px; flex-wrap: wrap; }
.prof-left { display: grid; gap: 8px; justify-items: center; align-content: start; width: 150px; }
.prof-left .btn { width: 100%; }
.prof-av .avatar { border-radius: 10px; }
.prof-right { flex: 1; min-width: 260px; display: grid; gap: 4px; align-content: start; }
.prof-name { font-size: 20px; }
.prof-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 22px; margin-top: 12px; }
.prof-stats > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 6px 0; font-size: 14px; }
.prof-stats span { color: var(--muted); }
.people { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.person { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.org .person { box-shadow: none; border: 1px solid var(--line); }
.org h2 { margin-bottom: 12px; }
.hello { display: flex; gap: 14px; align-items: center; }
.quick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 10px; }
.quick a { display: grid; gap: 2px; text-decoration: none; color: var(--navy); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.quick a:hover { border-color: var(--blue); background: #f7fbff; }
.quick span { font-size: 13px; color: var(--muted); }
.tabs { border-bottom: 1px solid var(--line); }

@media (max-width: 1100px) { .dash-top { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .prog-tiles { grid-template-columns: 1fr; }
  .pt { min-height: 0; }
  .kpi-val { font-size: 24px; }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .act-card { flex-wrap: wrap; }
  .act-actions { flex-direction: row; width: 100%; }
  .prof-left { width: 100%; grid-template-columns: auto 1fr 1fr; align-items: center; }
}

@media (max-width: 760px) { .my-bar .btn { flex: 1 1 40%; } .my-bar .grow { display: none; } .my-bar > div:first-child { width: 100% !important; } }
