/* home-admin – trang tổng quan nội bộ (tiền tố hd-) */
.hd-root { --hd-gap: 14px; display: flex; flex-direction: column; gap: var(--hd-gap); min-width: 0; }
.hd-root a { color: inherit; text-decoration: none; }
.hd-root h3 { margin: 0; font-size: 15px; }

/* Đầu trang */
.hd-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; padding: 18px 20px; border-radius: 14px; color: #fff;
  background: radial-gradient(120% 160% at 100% 0%, #1d5fc4 0%, transparent 55%), linear-gradient(135deg, var(--brand) 0%, #0b3a7a 100%); box-shadow: var(--shadow); }
.hd-hi h2 { margin: 0 0 4px; font-size: 22px; color: #fff; }
.hd-hi p { margin: 0; color: #c9d7ee; font-size: 13px; }
.hd-role { display: inline-block; padding: 1px 8px; border-radius: 99px; background: rgb(255 255 255 / 16%); color: #fff; font-weight: 600; font-size: 12px; }
.hd-ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hd-seg { background: rgb(255 255 255 / 10%); border-color: rgb(255 255 255 / 22%); }
.hd-seg button { color: #dbe6f7; padding: 6px 12px; font-size: 13px; }
.hd-seg button + button { border-left-color: rgb(255 255 255 / 18%); }
.hd-seg button.active { background: #fff; color: var(--brand); font-weight: 600; }
.hd-rf.btn { color: #fff; border-color: rgb(255 255 255 / 30%); background: transparent; display: inline-flex; gap: 6px; align-items: center; }
.hd-rf.btn:hover { background: rgb(255 255 255 / 12%); }
.hd-rf.spin span:last-child { display: inline-block; animation: hd-spin .8s linear infinite; }
.hd-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgb(52 211 153 / 60%); animation: hd-pulse 2s infinite; }
@keyframes hd-spin { to { transform: rotate(360deg); } }
@keyframes hd-pulse { 70% { box-shadow: 0 0 0 7px rgb(52 211 153 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(52 211 153 / 0%); } }
.hd-acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.hd-acts .btn { background: rgb(255 255 255 / 12%); color: #fff; border: 1px solid rgb(255 255 255 / 20%); }
.hd-acts .btn:hover { background: rgb(255 255 255 / 22%); }
.hd-cmp { margin: -4px 2px 0; }

/* Chỉ số */
.hd-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hd-kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px 10px; border: 1px solid transparent; transition: border-color .15s, transform .15s; }
a.hd-kpi:hover { border-color: var(--brand-soft, #e3ecfa); transform: translateY(-1px); }
.hd-kpi.warn { border-color: #fbbf24; }
.hd-k-top { display: flex; gap: 6px; align-items: center; justify-content: space-between; min-width: 0; }
.hd-k-top > span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-k-top > span i { font-style: normal; margin-right: 5px; }
.hd-kpi > b { font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-k-bot { display: flex; align-items: flex-end; gap: 8px; justify-content: space-between; min-height: 28px; }
.hd-k-bot small { font-size: 12px; line-height: 1.35; min-width: 0; }
.hd-spark { width: 92px; height: 28px; flex: none; overflow: visible; }
.hd-d { flex: none; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hd-d.up { background: #ecfdf5; color: #047857; }
.hd-d.down { background: #fef2f2; color: #b91c1c; }
.hd-d.flat { background: var(--surface-2); color: var(--muted); }

/* Lưới */
.hd-top { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--hd-gap); align-items: stretch; }
.hd-g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--hd-gap); align-items: start; }
.hd-g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--hd-gap); align-items: start; }
.hd-top.one, .hd-g2.one { grid-template-columns: minmax(0, 1fr); }
.hd-card { margin: 0; min-width: 0; }
.hd-ch { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.hd-ch h3 { margin-right: auto; }
.hd-more { font-size: 12.5px; color: var(--brand-2) !important; font-weight: 600; white-space: nowrap; }
.hd-sec { display: flex; flex-direction: column; gap: 10px; }
.hd-st { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 2px 0 !important; }
.hd-col2 { display: flex; flex-direction: column; gap: var(--hd-gap); min-width: 0; }

/* Hôm nay */
.hd-today { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; }
.hd-ring { --p: 0; width: 104px; height: 104px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#2563eb calc(var(--p) * 1%), var(--surface-2) 0); }
.hd-ring > div { width: 80px; height: 80px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hd-ring b { font-size: 20px; } .hd-ring small { font-size: 10.5px; color: var(--muted); }
.hd-tnum { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hd-big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hd-big small { font-size: 14px; color: var(--muted); font-weight: 600; }
.hd-prog { position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.hd-prog i { display: block; height: 100%; border-radius: 99px; background: #2563eb; }
.hd-prog em, .hd-pb em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; opacity: .55; }
.hd-hours { position: relative; padding-bottom: 16px; }
.hd-hours svg { display: block; width: 100%; height: 96px; }
.hd-hx { position: absolute; left: 0; right: 0; bottom: 0; height: 14px; }
.hd-hx span { position: absolute; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); }
.hd-chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.hd-chip { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.hd-chip b { font-size: 18px; font-variant-numeric: tabular-nums; }
.hd-chip span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-chip.z b { color: var(--muted); font-weight: 600; }
.hd-chip.blue { background: #eff6ff; border-color: #bfdbfe; } .hd-chip.blue b { color: #1d4ed8; }
.hd-chip.amber { background: #fffbeb; border-color: #fde68a; } .hd-chip.amber b { color: #b45309; }
.hd-chip.red { background: #fef2f2; border-color: #fecaca; } .hd-chip.red b { color: #b91c1c; }
.hd-chip.green { background: #ecfdf5; border-color: #a7f3d0; } .hd-chip.green b { color: #047857; }
.hd-chip:hover { filter: brightness(.97); }

/* Việc cần làm */
.hd-todo { display: flex; flex-direction: column; gap: 6px; }
.hd-ti { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--line); transition: background .15s; }
.hd-ti:hover { background: var(--brand-soft, #e3ecfa); }
.hd-ti.red { border-left-color: var(--danger); } .hd-ti.amber { border-left-color: #f59e0b; } .hd-ti.blue { border-left-color: var(--brand-2); }
.hd-tn { min-width: 34px; height: 26px; padding: 0 7px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); }
.hd-ti.red .hd-tn { color: #b91c1c; } .hd-ti.amber .hd-tn { color: #b45309; } .hd-ti.blue .hd-tn { color: #1d4ed8; }
.hd-tl { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; }
.hd-tl small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.hd-ta { color: var(--muted); font-size: 18px; }
.hd-empty { text-align: center; padding: 18px 8px; }
.hd-empty > div { font-size: 34px; }
.hd-empty p { margin: 4px 0 0; }

/* Biểu đồ cột chồng */
.hd-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.hd-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hd-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hd-legend i.ln { height: 3px; border-radius: 2px; width: 14px; }
.hd-legend b { color: var(--text); font-weight: 600; }
.hd-stack { display: flex; align-items: flex-end; gap: 2px; padding-bottom: 18px; position: relative; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.hd-col { flex: 1 1 0; min-width: 2px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.hd-col:hover .hd-bar { filter: brightness(1.12); }
.hd-bar { display: flex; flex-direction: column; gap: 1px; border-radius: 4px 4px 0 0; overflow: hidden; }
.hd-bar i { display: block; min-height: 1px; }
.hd-col > span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.hd-col.now .hd-bar { outline: 2px solid rgb(37 99 235 / 25%); outline-offset: 1px; }
.hd-sum { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.hd-sum b { color: var(--text); font-variant-numeric: tabular-nums; } .hd-sum b.ok { color: var(--ok); }

/* Dòng tiền */
.hd-flow { display: flex; gap: 2px; height: 150px; padding-bottom: 18px; position: relative; }
.hd-fc { flex: 1 1 0; min-width: 2px; display: flex; flex-direction: column; position: relative; }
.hd-fu, .hd-fd { flex: 1; display: flex; }
.hd-fu { align-items: flex-end; border-bottom: 1px solid var(--line); }
.hd-fd { align-items: flex-start; }
.hd-fu i, .hd-fd i { display: block; width: 100%; }
.hd-fu i { border-radius: 3px 3px 0 0; } .hd-fd i { border-radius: 0 0 3px 3px; }
.hd-fc > span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.hd-fc:hover i { filter: brightness(1.12); }

/* Danh sách / xếp hạng */
.hd-list { display: flex; flex-direction: column; }
.hd-li { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hd-li:last-child { border-bottom: 0; }
.hd-li:hover b { color: var(--brand-2); }
.hd-lt { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.hd-lt .muted { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-lv { font-weight: 700; font-variant-numeric: tabular-nums; } .hd-lv small { color: var(--muted); font-weight: 500; }
.hd-lm { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.hd-lm > span:first-child { margin-right: auto; }
.hd-pb { position: relative; height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 5px; }
.hd-pb i { display: block; height: 100%; border-radius: 99px; background: #2563eb; }
.hd-pb.low i { background: #d97706; }
.hd-rank { display: flex; flex-direction: column; gap: 4px; }
.hd-rank a { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.hd-rank a > div { flex: 1; min-width: 0; }
.hd-rank em { font-style: normal; width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.hd-rank a:first-child em { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.hd-rt { display: flex; gap: 8px; justify-content: space-between; }
.hd-rt b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.hd-rt span { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.hd-rank a:hover b { color: var(--brand-2); }

/* Vành khuyên */
.hd-donut-w { display: flex; gap: 16px; align-items: center; }
.hd-donut { width: 120px; height: 120px; flex: none; border-radius: 50%; display: grid; place-items: center; }
.hd-donut > div { width: 76px; height: 76px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface); }
.hd-donut b { font-size: 18px; } .hd-donut small { font-size: 11px; color: var(--muted); }
.hd-dl { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.hd-dl li { display: flex; gap: 6px; align-items: center; }
.hd-dl i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hd-dl span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-dl b { font-variant-numeric: tabular-nums; } .hd-dl small { width: 36px; text-align: right; color: var(--muted); }

/* Phễu */
.hd-fun { display: flex; flex-direction: column; gap: 10px; }
.hd-fl { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.hd-fl span { flex: 1; } .hd-fl b { font-variant-numeric: tabular-nums; } .hd-fl small { font-size: 11.5px; }
.hd-fb { height: 12px; border-radius: 6px; background: var(--surface-2); margin-top: 4px; overflow: hidden; }
.hd-fb i { display: block; height: 100%; border-radius: 6px; }

/* Tài chính */
.hd-fts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hd-ft { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.hd-ft:hover { border-color: #bfdbfe; }
.hd-ft span { font-size: 12px; color: var(--muted); }
.hd-ft b { font-size: 18px; font-variant-numeric: tabular-nums; }
.hd-ft small { font-size: 11.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hd-ft.warn { background: #fffbeb; border-color: #fde68a; } .hd-ft.warn b { color: #b45309; }
.hd-debt { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.hd-debt > div { display: flex; flex-direction: column; min-width: 0; }
.hd-debt b { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-debt .bad b { color: var(--danger); }
.hd-aging { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; margin-bottom: 8px; background: var(--surface-2); }
.hd-aging i { display: block; min-width: 3px; }

/* Hệ thống */
.hd-hcs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hd-hc { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); min-width: 0; }
.hd-hc i { font-style: normal; width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.hd-hc.ok i { background: var(--ok); } .hd-hc.bad i { background: #d97706; }
.hd-hc span { font-size: 13px; font-weight: 600; min-width: 0; }
.hd-hc small { display: block; font-weight: 400; font-size: 11.5px; }
.hd-setup { margin-top: 12px; }
.hd-setup ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.hd-staff { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; }

/* Hoạt động */
.hd-feed { list-style: none; margin: 0; padding: 0; }
.hd-feed li + li { border-top: 1px solid var(--line); }
.hd-feed a { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.hd-fi { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.hd-ftx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hd-ftx b { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-ftx small { font-size: 11.5px; }
.hd-fa { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ok); white-space: nowrap; font-size: 13px; }
.hd-fa.neg { color: var(--danger); }
.hd-feed a:hover b { color: var(--brand-2); }

/* Màn hình vừa */
@media (max-width: 1100px) {
  .hd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-top, .hd-g3 { grid-template-columns: minmax(0, 1fr); }
  .hd-g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .hd-g2, .hd-g3 { grid-template-columns: minmax(0, 1fr); }
  .hd-hero { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .hd-ctl { justify-content: flex-start; }
}
/* Điện thoại */
@media (max-width: 600px) {
  .hd-root { --hd-gap: 10px; }
  .hd-hi h2 { font-size: 18px; }
  .hd-seg { display: flex; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .hd-seg button { flex: 1 1 auto; padding: 6px 4px; font-size: 12px; white-space: nowrap; }
  .hd-ctl { flex-wrap: wrap; }
  .hd-acts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .hd-acts .btn { flex: none; }
  .hd-kpis { gap: 8px; }
  .hd-kpi { padding: 10px 11px 8px; }
  .hd-kpi > b { font-size: 19px; }
  .hd-k-top { flex-wrap: wrap; }
  .hd-k-top > span { font-size: 10.5px; }
  .hd-k-bot { flex-direction: column; align-items: stretch; gap: 4px; }
  .hd-spark { width: 100%; height: 22px; }
  .hd-today { gap: 12px; }
  .hd-ring { width: 84px; height: 84px; } .hd-ring > div { width: 64px; height: 64px; } .hd-ring b { font-size: 16px; }
  .hd-big { font-size: 22px; }
  .hd-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .hd-chip { padding: 6px 8px; } .hd-chip b { font-size: 16px; } .hd-chip span { font-size: 10.5px; }
  .hd-donut { width: 100px; height: 100px; } .hd-donut > div { width: 64px; height: 64px; }
  .hd-fts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hd-ft b { font-size: 16px; }
  .hd-debt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hd-hcs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hd-stack { gap: 1px; }
}
