:root {
  --bg: #dce4fc; --lav: #b4c6fc; --lav2: #d3ddfd; --lav3: #eef2fe;
  --ink: #0b0b0d; --ink2: #55565c; --ink3: #8b8c93; --gray: #efeff1; --gray2: #f6f6f7;
  --line: #e6e6ea; --white: #fff; --up: #12a150; --down: #e5484d;
  --r-xl: 32px; --r-lg: 24px; --r-md: 18px;
}
* { box-sizing: border-box; margin: 0; }
html, body { background: var(--bg); color: var(--ink); font-family: "Outfit", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; padding: 0; background: var(--white); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
a { cursor: pointer; color: inherit; text-decoration: none; }
.hidden { display: none !important; }
i[data-i] { display: inline-flex; width: 18px; height: 18px; }
i[data-i] svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--ink3); }

/* ===== khung ===== */
.frame { display: flex; gap: 36px; width: 100%; background: var(--white); padding: 16px 32px 16px 16px; min-height: 100vh; }
.side { width: 196px; flex: none; background: var(--lav); border-radius: var(--r-xl); padding: 28px 16px; display: flex; flex-direction: column; position: sticky; top: 16px; height: calc(100vh - 32px); overflow-y: auto; }
.logo { width: 44px; height: 44px; margin: 0 8px 56px; color: var(--ink); }
.logo svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
#nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
#nav a, .side-out { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 999px; font-size: 15px; font-weight: 500; transition: .15s; }
#nav a:hover { background: rgba(255,255,255,.4); }
#nav a.on { background: var(--ink); color: #fff; }
.side-out { color: var(--ink2); font-size: 14px; }
.main { flex: 1; min-width: 0; padding: 22px 0 32px; }

/* ===== header ===== */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 26px; }
.top > div:first-child { min-width: 0; }
.top h1 { font-size: 30px; font-weight: 600; letter-spacing: -.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--ink2); font-size: 14px; margin-top: 6px; }
.top-r { display: flex; align-items: center; gap: 10px; flex: none; }
.search { display: flex; align-items: center; gap: 10px; background: var(--gray); border-radius: 999px; padding: 0 20px; height: 52px; width: 300px; color: var(--ink2); }
.search input { border: 0; background: none; outline: none; flex: 1; font-size: 14px; }
.day-pick { height: 52px; border-radius: 999px; border: 0; background: var(--gray); padding: 0 16px; font-size: 14px; color: var(--ink2); }
.circle { width: 52px; height: 52px; border-radius: 50%; background: var(--gray); display: inline-flex; align-items: center; justify-content: center; position: relative; flex: none; }
.circle.black, .circle.blk { background: var(--ink); color: #fff; }
.circle.lav { background: var(--lav); }
.circle.sm { width: 44px; height: 44px; background: #fff; border: 1px solid var(--line); }
.circle.xs { width: 30px; height: 30px; } .circle.xs i { width: 14px; height: 14px; }
.dot { position: absolute; top: 12px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--down); }
.dot.ok { background: var(--up); }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--lav) center/cover; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 20px; flex: none; }

h2 { font-size: 28px; font-weight: 600; letter-spacing: -.5px; }
h2.mt { margin-top: 30px; }
.panel h2, .row-b h2 { font-size: 20px; }

/* ===== hàng 1: hero + thẻ hãng ===== */
.row1 { display: grid; grid-template-columns: minmax(330px, 380px) minmax(0, 1fr); gap: 28px; margin-bottom: 30px; }
.hero { background: var(--lav); border-radius: var(--r-xl); padding: 30px 26px 24px; text-align: center; display: flex; flex-direction: column; }
.hero-lbl { color: var(--ink2); font-size: 14px; }
.hero-num { font-size: 50px; font-weight: 500; letter-spacing: -1px; margin: 4px 0 2px; }
.hero-sub { font-size: 13px; color: var(--ink2); min-height: 18px; }
.hero-acts { display: flex; justify-content: space-around; margin-top: auto; padding-top: 20px; }
.hero-acts button { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.hero-acts span { width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .15s; }
.hero-acts button:hover span { transform: translateY(-2px); }
/* lưới 1 hàng tự co theo bề ngang: thẻ nào không đủ chỗ thì ẩn, không cuộn ngang */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); grid-template-rows: auto; grid-auto-rows: 0; column-gap: 16px; row-gap: 0; overflow: hidden; }
.cards::-webkit-scrollbar { display: none; }
.cards > *, .dealers-strip > * { overflow: hidden; }
.bcard { min-width: 0; background: var(--gray); border-radius: var(--r-lg); padding: 22px 20px; display: flex; flex-direction: column; min-height: 196px; cursor: pointer; transition: transform .15s; }
.bcard:hover { transform: translateY(-3px); }
.bcard.hl { background: var(--lav); }
.bcard-hd { display: flex; justify-content: space-between; align-items: center; }
.bcard-name { font-weight: 700; font-size: 17px; font-style: italic; letter-spacing: -.3px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcard-lbl { margin-top: auto; font-size: 13px; color: var(--ink2); }
.bcard-num { font-size: 26px; font-weight: 600; margin: 2px 0 14px; }
.bcard-num small { font-size: 15px; }
.bcard-ft { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink2); white-space: nowrap; }

/* ===== hàng 2 ===== */
.row2 { display: grid; grid-template-columns: minmax(330px, 380px) minmax(0, 1fr); gap: 28px; margin-bottom: 30px; }
.col { min-width: 0; }
.dealers-strip { margin-top: 18px; background: var(--gray); border-radius: var(--r-lg); padding: 18px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); grid-template-rows: auto; grid-auto-rows: 0; column-gap: 8px; row-gap: 0; overflow: hidden; }
.dealers-strip::-webkit-scrollbar { display: none; }
.dl { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; font-size: 12px; font-weight: 500; text-align: center; cursor: pointer; }
.dl .av { width: 48px; height: 48px; border-radius: 50%; background: var(--lav) center/cover; display: flex; align-items: center; justify-content: center; font-weight: 600; position: relative; }
.dl .av b { position: absolute; bottom: -4px; right: -4px; background: var(--ink); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 6px; }
.dl span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(#000 85%, transparent); mask-image: linear-gradient(#000 85%, transparent); padding-bottom: 30px; }
.fi { background: var(--gray); border-radius: var(--r-md); padding: 14px 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.fi .ic { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.fi .mid { flex: 1; min-width: 0; }
.fi .t { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi .s { color: var(--ink2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi .rt { text-align: right; flex: none; }
.fi .p { font-weight: 600; font-size: 15px; }

.stat-hd { display: flex; align-items: center; gap: 10px; }
.stat-hd h2 { flex: 1; white-space: nowrap; }
.seg { display: inline-flex; background: var(--gray); border-radius: 999px; padding: 4px; flex-wrap: wrap; }
.seg button { padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.seg button.on { background: var(--ink); color: #fff; }
.stat-card { margin-top: 18px; background: var(--gray); border-radius: var(--r-lg); padding: 18px 20px 14px; }
.stat-top { display: flex; justify-content: space-between; }
.pill-out { border: 1px solid #d5d5da; border-radius: 999px; padding: 10px 18px; display: inline-flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 500; background: transparent; }
.pill-out:hover { background: #fff; }
.stat-big { font-size: 34px; font-weight: 600; margin: 12px 0 4px; letter-spacing: -.5px; }
.stat-big small { font-size: 18px; font-weight: 500; color: var(--ink2); }
.stat-lg { display: flex; gap: 16px; font-size: 12px; color: var(--ink2); }
.stat-lg span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.lav { background: var(--lav); } .sw.blk { background: var(--ink); }
.chart-box { position: relative; height: 220px; margin-top: 8px; }
.chart-box.tall { height: 300px; }
.mini2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.mini { background: linear-gradient(var(--gray), var(--gray2)); border-radius: var(--r-md); padding: 14px 16px; cursor: pointer; }
.mini-l { font-size: 13px; color: var(--ink2); }
.mini-v { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 14px; color: var(--ink2); }
.mini-v b { font-size: 20px; color: var(--ink); }

/* ===== bảng ===== */
.row3 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.panel { background: var(--gray2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; min-width: 0; }
.panel-hd { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-hd a { font-size: 14px; color: var(--ink2); display: inline-flex; gap: 6px; align-items: center; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink3); font-weight: 500; padding: 8px 10px; white-space: nowrap; cursor: pointer; user-select: none; }
.tbl td { padding: 12px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--lav3); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .b { font-weight: 600; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--lav2); }
.chip.used { background: #fde8c8; }
.chg { display: inline-block; min-width: 58px; text-align: right; font-weight: 500; }
.spark { display: block; }
.movers { display: flex; flex-direction: column; gap: 8px; }
.mv { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #fff; border-radius: 14px; cursor: pointer; }
.mv .n { flex: 1; min-width: 0; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv .n small { display: block; color: var(--ink3); font-weight: 400; }
.mv .badge { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; }
.mv .badge.up { background: #ddf5e6; } .mv .badge.down { background: #fde3e3; }
.mv-sec { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink3); margin: 6px 0 2px; }

.row-b { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.brand-grid .bcard { flex: none; }
.row-r { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.rep-list { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow-y: auto; }
.rep-list a { padding: 12px 16px; border-radius: 14px; background: #fff; display: flex; justify-content: space-between; font-size: 14px; }
.rep-list a.on { background: var(--ink); color: #fff; }
.rep-text { white-space: pre-wrap; font-family: inherit; font-size: 15px; line-height: 1.6; background: #fff; border-radius: 16px; padding: 20px; max-height: 70vh; overflow: auto; }

/* ===== zalo ===== */
.zalo-box { text-align: center; }
.zalo-box img.qr { width: 240px; height: 240px; border-radius: 16px; background: #fff; padding: 10px; margin: 16px auto; display: block; }
.zalo-box .big-av { width: 88px; height: 88px; border-radius: 50%; margin: 14px auto; background: var(--lav) center/cover; }
.zalo-box p { color: var(--ink2); font-size: 14px; margin: 8px 0; line-height: 1.5; }
.state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--gray); }
.state.ok { background: #ddf5e6; color: #0b7a3b; } .state.bad { background: #fde3e3; color: #b42318; }
.switch { width: 44px; height: 26px; border-radius: 999px; background: #d5d5da; position: relative; transition: .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch.on { background: var(--ink); } .switch.on::after { left: 21px; }

/* ===== chung ===== */
.btn-black { background: var(--ink); color: #fff; border-radius: 999px; padding: 14px 24px; font-weight: 500; font-size: 15px; }
.btn-black.sm { padding: 10px 18px; font-size: 14px; }
.btn-black:disabled { opacity: .5; }
.modal { position: fixed; inset: 0; background: rgba(15,18,40,.35); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 32px; padding: 30px; width: min(920px, 100%); max-height: 92vh; overflow-y: auto; position: relative; }
.modal-x { position: absolute; top: 18px; right: 18px; }
.m-hd { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding-right: 60px; }
.m-hd h3 { font-size: 26px; font-weight: 600; }
.m-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.m-kpi { background: var(--gray); border-radius: 16px; padding: 14px; }
.m-kpi .l { font-size: 12px; color: var(--ink2); } .m-kpi .v { font-size: 20px; font-weight: 600; margin-top: 4px; }
.m-kpi.hl { background: var(--lav); }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 16px; font-size: 14px; z-index: 60; max-width: 360px; }
.toast.err { background: var(--down); }
.empty { padding: 30px; text-align: center; color: var(--ink3); font-size: 14px; }
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 10%, #c9d6fd, transparent), radial-gradient(900px 500px at 90% 90%, #a9bcfa, transparent), var(--bg); }
.login-card { background: #fff; border-radius: 36px; box-shadow: 0 30px 80px rgba(40, 60, 140, .18); padding: 48px 40px; width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.login-card .logo { margin: 0 auto 6px; width: 56px; height: 56px; background: var(--lav); border-radius: 18px; padding: 10px; }
.login-card h1 { font-size: 26px; font-weight: 600; }
.login-card p { color: var(--ink2); font-size: 14px; margin-bottom: 8px; }
.login-card input { height: 52px; border-radius: 999px; border: 0; background: var(--gray); padding: 0 22px; outline: none; }
.err { color: var(--down); font-size: 13px; min-height: 16px; }

/* ===== responsive ===== */
@media (max-width: 1180px) {
  .row1, .row2, .row3 { grid-template-columns: 1fr; }
  .search { width: 220px; }
  .day-pick { display: none; }
}
@media (max-width: 860px) {
  body { padding: 0; }
  .frame { border: 0; border-radius: 0; padding: calc(16px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); gap: 0; min-height: 100vh; }
  .side { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; top: auto; height: auto; width: auto; flex-direction: row; padding: 8px; z-index: 40; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
  .side .logo, .side-out { display: none; }
  #nav { flex-direction: row; justify-content: space-between; gap: 2px; overflow-x: auto; }
  #nav a { padding: 12px; } #nav a span { display: none; }
  #nav a.on span { display: inline; font-size: 13px; }
  .main { padding: 0; }
  .top { flex-direction: column; }
  .top-r { width: 100%; flex-wrap: wrap; }
  .search { flex: 1; width: auto; min-width: 0; }
  .day-pick { display: none; }
  .top h1 { font-size: 24px; }
  h2 { font-size: 22px; }
  .hero-num { font-size: 40px; }
  .row-b, .row-r { grid-template-columns: 1fr; }
  .m-kpis { grid-template-columns: 1fr 1fr; }
  .modal { padding: calc(12px + env(safe-area-inset-top)) 10px 12px; align-items: flex-start; }
  .modal-card { padding: 22px 16px; border-radius: 24px; max-height: calc(100vh - 40px - env(safe-area-inset-top)); }
  .toast { left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); }
}
