:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #64748b;
  --brand: #2b5cff;
  --brand-dark: #1e46d0;
  --brand-soft: #e8eeff;
  --green: #0f9d58;
  --green-soft: #e6f6ee;
  --amber: #f59e0b;
  --red: #e5484d;
  --line: #e2e8f0;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 10px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--ink); }
.logo .badge-logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #7c3aed); color: #fff; font-size: 18px;
}
.topbar nav { margin-left: auto; display: flex; gap: 4px; font-size: 14.5px; }
.topbar nav a { color: var(--muted); padding: 8px 10px; border-radius: 10px; }
.topbar nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* Hero */
.hero { background: linear-gradient(160deg, #182a5e 0%, #2447b3 55%, #2b5cff 100%); color: #fff; padding: 46px 0 92px; position: relative; }
.hero h1 { font-size: clamp(24px, 5vw, 40px); line-height: 1.25; font-weight: 800; max-width: 640px; }
.hero p.sub { margin: 12px 0 22px; color: #d6e0ff; font-size: 16.5px; max-width: 560px; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero .chip { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); padding: 6px 12px; border-radius: 999px; font-size: 13.5px; }
.stat-strip { margin-top: -56px; padding-bottom: 8px; }
.stat-strip .inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat-card b { font-size: 22px; display: block; }
.stat-card span { color: var(--muted); font-size: 13px; }

/* Sections */
section.block { padding: 30px 0 6px; }
h2.title { font-size: 21px; font-weight: 800; margin-bottom: 4px; }
p.title-sub { color: var(--muted); margin-bottom: 18px; font-size: 14.5px; }

/* App grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.app-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid transparent; transition: .15s;
}
.app-card:hover { border-color: #c9d6ff; transform: translateY(-2px); }
.app-card .head { display: flex; gap: 12px; align-items: flex-start; }
.app-icon {
  width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; background: var(--brand-soft);
}
.app-card h3 { font-size: 16.5px; line-height: 1.35; }
.app-card .tagline { color: var(--muted); font-size: 14px; flex: 1; }
.price-row { display: flex; align-items: baseline; gap: 8px; }
.price-free { color: var(--green); font-weight: 800; font-size: 15px; }
.price-paid { color: var(--brand-dark); font-weight: 800; font-size: 17px; }
.price-old { color: var(--muted); text-decoration: line-through; font-size: 13.5px; }
.app-card .meta { display: flex; gap: 12px; color: var(--muted); font-size: 12.5px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: .15s; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #0b7a45; }
.btn-ghost { background: var(--brand-soft); color: var(--brand-dark); }
.btn-ghost:hover { background: #dbe6ff; }
.btn-red { background: #fdecec; color: var(--red); }
.btn-sm { padding: 8px 12px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Donate */
.donate {
  background: linear-gradient(135deg, #fff8ec, #fff); border: 1px dashed #f2c66d;
  border-radius: var(--radius); padding: 22px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
}
.donate img.qr { width: 150px; height: 150px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

/* Page generic */
.page { padding: 26px 0 60px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* Buy page */
.order-code {
  font-size: 26px; font-weight: 900; letter-spacing: 2px; color: var(--brand-dark);
  background: var(--brand-soft); border-radius: 12px; padding: 10px 18px; display: inline-block;
  user-select: all;
}
.qr-big { width: min(300px, 78vw); border-radius: 14px; border: 1px solid var(--line); display: block; margin: 0 auto; }
.steps { counter-reset: st; list-style: none; }
.steps li { counter-increment: st; position: relative; padding: 0 0 14px 40px; }
.steps li::before {
  content: counter(st); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13.5px;
}
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 700; }
.st-pending { background: #fff4e0; color: #b25e00; }
.st-confirmed { background: var(--green-soft); color: var(--green); }
.st-cancelled { background: #fdecec; color: var(--red); }

/* Footer */
footer.site { margin-top: 50px; border-top: 1px solid var(--line); background: #fff; padding: 26px 0 34px; color: var(--muted); font-size: 14px; }

/* ---------- DASHBOARD ---------- */
body.admin { background: #f1f4f9; }
.login-box { max-width: 380px; margin: 12vh auto; }
.dash-head { background: #101a33; color: #fff; }
.dash-head .wrap { display: flex; align-items: center; height: 58px; gap: 10px; }
.dash-head .logo { color: #fff; }
.dash-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0; }
.tab { border: 0; background: #fff; border: 1px solid var(--line); padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.kpi b { font-size: 21px; display: block; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.warn b { color: #b25e00; }
.kpi.good b { color: var(--green); }
.kpi.brand b { color: var(--brand-dark); }
.progress { background: #e6ebf5; border-radius: 999px; height: 12px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7c3aed); border-radius: 999px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-size: 12.5px; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 8px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.tbl tr:hover td { background: #f8faff; }
.tbl .wrap-cell { max-width: 260px; overflow-wrap: anywhere; }
.mini-bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.mini-bars .bar { flex: 1; background: var(--brand-soft); border-radius: 4px 4px 0 0; position: relative; }
.mini-bars .bar i { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); font-style: normal; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.f { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 10px 0 5px; }
input[type=text], input[type=email], input[type=number], input[type=password], textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
textarea { min-height: 88px; resize: vertical; }
.pill-req { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.rs-moi { background: #e8f0ff; color: #1e46d0; }
.rs-dang_lam { background: #fff4e0; color: #b25e00; }
.rs-da_len_web { background: #e9fbf1; color: #0b7a45; }
.rs-da_dang_mxh { background: #f3e8ff; color: #7c2dae; }
.rs-hoan_tat { background: #e6f6ee; color: var(--green); }
.rs-huy { background: #fdecec; color: var(--red); }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #101a33; color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 99; opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; }

@media (max-width: 620px) {
  .stat-strip .inner { grid-template-columns: 1fr; }
  .stat-strip .inner .stat-card { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 16px; }
  .stat-strip b { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .tbl-scroll { overflow-x: auto; }
  .topbar nav a { padding: 8px 6px; font-size: 13.5px; }
  .hero { padding: 34px 0 84px; }
}

/* ===================== BỐ CỤC MỚI THEO WEB MẪU ===================== */

/* Live monitor */
.live-card {
  margin-top: -52px; position: relative; z-index: 5;
  background: #101a33; color: #fff; border-radius: 20px; box-shadow: var(--shadow);
  padding: 20px 22px; display: grid; grid-template-columns: 92px 1fr auto; gap: 18px; align-items: center;
}
.live-mascot {
  width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-size: 40px;
  background: radial-gradient(circle at 30% 30%, #ffe27a, #f5b100); box-shadow: 0 0 0 5px rgba(255,214,64,.18);
  animation: motPulse 2.6s ease-in-out infinite;
}
@keyframes motPulse { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.live-card .what { font-size: 16.5px; font-weight: 700; line-height: 1.45; }
.live-card .what .st-ai { color: #ffd640; }
.live-card .shift { color: #9db1ff; font-size: 13.5px; margin-top: 6px; }
.live-right { text-align: right; font-size: 13.5px; color: #cdd8f5; }
.live-right b { font-size: 21px; color: #fff; display: block; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #35d07f; margin-right: 6px; animation: blink 1.6s infinite; }
.live-dot.sleep { background: #7f8db8; animation: none; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@media (max-width: 620px) {
  .live-card { grid-template-columns: 64px 1fr; }
  .live-mascot { width: 56px; height: 56px; font-size: 30px; }
  .live-right { grid-column: 1 / -1; text-align: left; display: flex; gap: 18px; align-items: baseline; }
}

/* Cột mốc */
.milestones { display: grid; gap: 10px; }
.ms-row { display: grid; grid-template-columns: 200px 1fr 46px; gap: 12px; align-items: center; font-size: 14px; }
.ms-row .ms-bar { background: #e6ebf5; border-radius: 999px; height: 10px; overflow: hidden; }
.ms-row .ms-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7c3aed); border-radius: 999px; }
.ms-row.done .ms-bar > i { background: var(--green); }
.ms-row.done { color: var(--green); font-weight: 700; }
.ms-row .ms-val { text-align: right; color: var(--muted); font-size: 12.5px; }
@media (max-width: 620px) { .ms-row { grid-template-columns: 1fr 40px; } .ms-row .ms-bar { grid-column: 1 / -1; order: 3; } }

/* Quẻ làm giàu */
.fortune {
  background: linear-gradient(135deg, #fffdf3, #fff6e0); border: 1px solid #f2dfae;
  border-radius: var(--radius); padding: 24px; text-align: center;
}
.fortune .q-icon { font-size: 40px; }
.fortune .q-text { font-size: 17px; font-weight: 700; max-width: 560px; margin: 10px auto 4px; line-height: 1.55; }
.fortune .q-sub { color: var(--muted); font-size: 13px; }

/* Bài viết */
.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.art-card {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 16px;
  display: flex; gap: 12px; align-items: flex-start; border: 1px solid transparent; transition: .15s;
}
.art-card:hover { border-color: #c9d6ff; transform: translateY(-2px); }
.art-card .ic { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; font-size: 22px; }
.art-card h3 { font-size: 15px; line-height: 1.4; }
.art-card p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.art-card .date { color: #9aa7bd; font-size: 12px; margin-top: 6px; display: block; }

/* Đặt làm riêng */
.flow-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.flow-steps .fs { background: #f7f9ff; border: 1px solid #e3eaff; border-radius: 12px; padding: 12px; font-size: 13px; }
.flow-steps .fs b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.flow-steps .fs .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 12px; margin-bottom: 7px; }
@media (max-width: 620px) { .flow-steps { grid-template-columns: 1fr 1fr; } }

/* Banner quảng cáo */
.ad-card { background: linear-gradient(135deg, #f4f0ff, #fff); border: 1px solid #e3d9ff; border-radius: var(--radius); padding: 22px; }
.ad-price { font-size: 24px; font-weight: 900; color: #6d28d9; }

/* Chat widget */
.chat-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #ffe27a, #f5b100); font-size: 28px;
  box-shadow: 0 6px 20px rgba(16,24,40,.25);
}
.chat-box {
  position: fixed; right: 18px; bottom: 86px; z-index: 90; width: min(330px, calc(100vw - 36px));
  background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(16,24,40,.28);
  display: none; flex-direction: column; overflow: hidden; border: 1px solid var(--line);
}
.chat-box.open { display: flex; }
.chat-head { background: #101a33; color: #fff; padding: 12px 16px; display: flex; gap: 10px; align-items: center; }
.chat-head .av { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffe27a, #f5b100); display: grid; place-items: center; font-size: 18px; }
.chat-head b { font-size: 14.5px; display: block; }
.chat-head span { font-size: 12px; color: #9db1ff; }
.chat-msgs { padding: 14px; height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; background: #f7f9ff; }
.msg { max-width: 85%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.msg.bot { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.user { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; background: #fff; border-top: 1px solid var(--line); }
.chat-quick button { border: 1px solid var(--line); background: #f7f9ff; border-radius: 999px; padding: 6px 11px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.chat-quick button:hover { border-color: var(--brand); color: var(--brand-dark); }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; background: #fff; }
.chat-input input { flex: 1; }

/* Bài viết chi tiết */
.article-body { font-size: 15.5px; }
.article-body p { margin: 10px 0; white-space: pre-line; }
.badge-new { background: #e8f0ff; color: var(--brand-dark); font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 9px; vertical-align: middle; }
@media (max-width: 900px) { #ledgerWrap { grid-template-columns: 1fr !important; } }

/* Biểu đồ truy cập */
.chart30 { display: flex; align-items: flex-end; gap: 5px; height: 150px; padding-top: 22px; }
.chart30 .b { flex: 1; background: #dbe4fb; border-radius: 5px 5px 0 0; position: relative; min-height: 3px; transition: .2s; }
.chart30 .b:hover { background: var(--brand); }
.chart30 .b > i { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); font-style: normal; white-space: nowrap; }
.chart30 .b.hot { background: linear-gradient(180deg, #2b5cff, #7c3aed); }
.chart30 .b > u { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 9.5px; color: #9aa7bd; text-decoration: none; white-space: nowrap; }

.chart24 { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.chart24 .b { flex: 1; background: #e6ebf5; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart24 .b.hot { background: var(--green); }
.chart24 .b > i { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 9px; color: #9aa7bd; font-style: normal; }

/* Vùng kéo thả file */
.dropzone {
  border: 2px dashed #c9d6ff; border-radius: 16px; padding: 26px 18px; text-align: center;
  background: #f7f9ff; cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: #eef3ff; }
.dropzone.has-file { border-color: var(--green); background: #f2fff8; border-style: solid; }

@media (max-width: 900px) {
  #trafficWrap, #trafficWrap2 { grid-template-columns: 1fr !important; }
  .chart30 .b > u { display: none; }
}
