/* Cong bao cao khach hang VietSmart: giao dien dashboard sang, nhieu mau, de doc */

:root {
  --bg: #eef1f7;
  --bg-soft: #f7f9fc;
  --surface: #ffffff;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --line: #e6e9f0;
  --brand: #3538cd;
  --brand-2: #0ea5e9;
  --blue: #2e6ff2;
  --green: #12a150;
  --violet: #7c3aed;
  --amber: #d97706;
  --pink: #db2777;
  --red: #d92d20;
  --shopee: #ee4d2d;
  --tiktok: #111827;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
  --shadow-lift: 0 2px 4px rgba(16, 24, 40, .07), 0 16px 32px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(900px 460px at 8% -10%, rgba(53, 56, 205, .10), transparent 60%),
    radial-gradient(760px 420px at 96% -6%, rgba(14, 165, 233, .12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
small { color: var(--ink-3); font-weight: 400; }

/* ---- thanh tren cung ---------------------------------------------------- */
header.topbar {
  background: linear-gradient(105deg, #201f68 0%, var(--brand) 45%, #1b7fd4 100%);
  color: #fff;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 6px 22px rgba(16, 24, 40, .18);
}
header.topbar .brand { display: flex; align-items: center; gap: 11px; }
header.topbar .logo {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: .4px;
}
header.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: .2px; }
header.topbar .sub { font-size: 12px; color: rgba(255, 255, 255, .72); }
header.topbar .spacer { flex: 1; }
header.topbar .top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pill {
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12px; white-space: nowrap;
}
.pill.dot::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; margin-right: 7px; vertical-align: 1px;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}

header.topbar select {
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 13px;
  border: 1px solid rgba(255, 255, 255, .26); border-radius: 999px; padding: 5px 10px;
}
header.topbar select option { color: #101828; }

.lang { display: flex; background: rgba(255, 255, 255, .14); border-radius: 999px; padding: 3px; gap: 2px; }
.lang button {
  border: 0; background: none; color: rgba(255, 255, 255, .8); cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: .5px; padding: 5px 12px; border-radius: 999px;
}
.lang button.on { background: #fff; color: var(--brand); }

.who {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, .92);
}
.who .avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, .2); font-size: 12px; font-weight: 700;
}
a.ghost {
  color: #fff; font-size: 13px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .3);
}
a.ghost:hover { background: rgba(255, 255, 255, .16); }

/* ---- tab ---------------------------------------------------------------- */
nav.tabs {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  display: flex; gap: 8px; overflow-x: auto;
  position: sticky; top: 63px; z-index: 15;
  scrollbar-width: thin;
}
nav.tabs button {
  border: 1px solid transparent; background: #f1f3f9; color: var(--ink-2);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: .15s;
}
nav.tabs button:hover { background: #e6eaf5; color: var(--ink); }
nav.tabs button.active {
  background: linear-gradient(100deg, var(--brand), #1b7fd4);
  color: #fff; box-shadow: 0 4px 12px rgba(53, 56, 205, .32);
}

main { max-width: 1180px; margin: 22px auto; padding: 0 18px 70px; }

/* ---- bo loc ------------------------------------------------------------- */
.filters {
  background: var(--surface); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px;
  display: flex; gap: 16px; align-items: end; flex-wrap: wrap; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.filters label {
  display: flex; flex-direction: column; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; color: var(--ink-3); gap: 5px;
}
.filters input, .filters select {
  padding: 8px 11px; border: 1px solid #d5dae5; border-radius: 10px; font-size: 14px;
  color: var(--ink); background: var(--bg-soft); font-family: inherit;
}
.filters input:focus, .filters select:focus {
  outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46, 111, 242, .16); background: #fff;
}
button.btn {
  background: linear-gradient(100deg, var(--brand), #1b7fd4); color: #fff; border: 0;
  padding: 9px 22px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  font-family: inherit; box-shadow: 0 4px 12px rgba(53, 56, 205, .28);
}
button.btn:hover { filter: brightness(1.06); }
button.btn.secondary { background: #e9ecf4; color: var(--ink); box-shadow: none; }

/* ---- the so lieu -------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 13px; transition: .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--blue));
}
.card .ico {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-size: 19px; background: #f1f3fa;
  background: color-mix(in srgb, var(--c, var(--blue)) 13%, #fff);
}
.card .label {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 3px;
}
.card .value { font-size: 21px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }

/* ---- khoi noi dung ------------------------------------------------------ */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 18px; margin-bottom: 18px; box-shadow: var(--shadow); overflow-x: auto;
}
.panel-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.panel h2 { font-size: 15px; margin: 0; font-weight: 700; letter-spacing: -.1px; }
.panel h2::before {
  content: ""; display: inline-block; width: 4px; height: 14px; border-radius: 3px;
  background: linear-gradient(var(--brand), var(--brand-2)); margin-right: 9px; vertical-align: -2px;
}
.panel-sub { font-size: 12px; color: var(--ink-3); margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: 1.9fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- bang --------------------------------------------------------------- */
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid #f0f2f6; white-space: nowrap; }
th {
  color: var(--ink-3); font-weight: 700; font-size: 11px; letter-spacing: .4px; text-transform: uppercase;
  background: var(--bg-soft); position: sticky; top: 0;
}
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
tbody tr:hover td { background: #f7f9ff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 800; border-top: 2px solid #d5dae5; background: #f5f7fd; }
tr.total td:first-child { border-radius: 0 0 0 8px; }
tr.total td:last-child { border-radius: 0 0 8px 0; }
td.wrap, th.wrap { white-space: normal; min-width: 230px; }
td.pos { color: var(--green); font-weight: 600; }

/* thanh ty le trong o phan tram */
.bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar .track { width: 62px; height: 6px; border-radius: 999px; background: #eaedf5; overflow: hidden; flex: none; }
.bar .track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.bar b { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

/* ---- nhan trang thai ---------------------------------------------------- */
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.den-cao, .badge-on { background: #e7f8ee; color: #067647; }
.den-tb { background: #fef6e7; color: #b54708; }
.den-thap { background: #fdecea; color: #b42318; }
.den-none, .badge-off { background: #f2f4f7; color: #667085; }
.den-cao, .den-tb, .den-thap, .den-none, .badge-on, .badge-off {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}

.chart-box { position: relative; height: 300px; }
.chart-box.small { height: 260px; }

/* ---- trang thai tai / loi ----------------------------------------------- */
.skeleton { display: grid; gap: 14px; }
.sk-row { height: 92px; border-radius: var(--radius); background: linear-gradient(90deg, #eef1f7 25%, #f7f9fc 50%, #eef1f7 75%); background-size: 400% 100%; animation: sk 1.3s infinite; }
.sk-row.tall { height: 240px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.msg { padding: 11px 15px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; }
.msg.ok { background: #e7f8ee; color: #067647; }
.msg.err { background: #fdecea; color: #b42318; }
pre.sync-out { background: #101828; color: #b9f6c5; padding: 13px; border-radius: 12px; overflow: auto; font-size: 12px; }

/* ---- dang nhap ---------------------------------------------------------- */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: 20px; padding: 34px 32px; width: 370px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .16); border: 1px solid var(--line);
}
.login-card .logo {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #1b7fd4); color: #fff; font-weight: 800; font-size: 18px;
}
.login-card h1 { font-size: 19px; text-align: center; margin: 0 0 4px; }
.login-card .tagline { text-align: center; color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.login-card input {
  padding: 11px 13px; border: 1px solid #d5dae5; border-radius: 11px; font-size: 14px;
  background: var(--bg-soft); font-family: inherit;
}
.login-card input:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46, 111, 242, .16); background: #fff; }
.login-card button {
  margin-top: 18px; background: linear-gradient(100deg, var(--brand), #1b7fd4); color: #fff; border: 0;
  padding: 12px; border-radius: 11px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.login-lang { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.login-lang button {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-2); cursor: pointer;
  font-size: 12px; font-weight: 700; padding: 6px 14px; border-radius: 999px; font-family: inherit;
}
.login-lang button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

@media (max-width: 640px) {
  header.topbar { padding: 10px 14px; }
  header.topbar .sub { display: none; }
  nav.tabs { top: 58px; padding: 8px 14px; }
  main { padding: 0 12px 60px; }
  .card .value { font-size: 19px; }
}
