/* Shop thuê acc — giao diện chung (khách + admin). Màu chính lấy từ cài đặt: --primary */
:root {
  --primary: #7c3aed;
  color-scheme: dark;
  --bg: #000;
  --bg2: #0a0a0a;
  --card: #101010;
  --card2: #1b1b1b;
  --line: #2a2a2a;
  --text: #f2f2f2;
  --muted: #a0a0a0;
  --accent-text: color-mix(in srgb, var(--primary) 50%, #fff);
  --radius-s: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #38bdf8;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.25; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, Consolas, monospace; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(0, 0, 0, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .container { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: .2px; }
.brand img { height: 52px; width: auto; max-width: 140px; object-fit: contain; }
.brand .dot { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), #38bdf8); display: grid; place-items: center; font-size: 18px; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a, .nav button.linkish { padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .93rem; }
.nav a:hover, .nav a.active { background: var(--card2); color: #fff; }
.wallet-pill { background: color-mix(in srgb, var(--primary) 22%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 50%, transparent); color: #fff !important; }
.menu-toggle { display: none; margin-left: auto; background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 18px; }
@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg2); border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .nav.open { display: flex; }
}

/* ---------- Thông báo chạy ---------- */
.notice { background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 30%, transparent), transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 16px 0; display: flex; gap: 10px; align-items: center; overflow: hidden; }
.notice .marquee { white-space: nowrap; animation: marquee 22s linear infinite; }
@keyframes marquee { from { transform: translateX(100%); } to { transform: translateX(-100%); } }

/* ---------- Hero ---------- */
.hero { padding: 26px 0 8px; display: grid; grid-template-columns: 1fr; gap: 20px; align-items: center; }
.hero h1 { font-size: 2rem; }
.hero h1 span { background: linear-gradient(90deg, var(--primary), #38bdf8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero-stats .s { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.hero-stats b { display: block; font-size: 1.4rem; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 1.5rem; } }

/* ---------- Danh mục / tìm kiếm ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .9rem; display: inline-flex; gap: 6px; align-items: center; }
.chip.active, .chip:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip img { width: 20px; height: 20px; border-radius: 6px; object-fit: cover; }
.search { display: flex; gap: 6px; }

/* ---------- Lưới sản phẩm ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s, box-shadow .15s; position: relative; }
.pcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 60%, var(--line)); box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--primary) 50%, transparent); }
.pcard .thumb { aspect-ratio: 16/10; background: var(--card2); overflow: hidden; position: relative; }
.pcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pcard .badge-tl { position: absolute; top: 10px; left: 10px; }
.pcard .badge-tr { position: absolute; top: 10px; right: 10px; }
.pcard .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard .name { font-weight: 700; font-size: 1.02rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.pcard .desc { color: var(--muted); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.price { font-size: 1.25rem; font-weight: 800; color: #fff; }
.price small { font-size: .8rem; font-weight: 500; }
.old-price { text-decoration: line-through; color: var(--muted); font-size: .9rem; margin-left: 6px; }
.pcard .foot { display: flex; gap: 8px; margin-top: auto; }
.pcard .foot .btn { flex: 1; }
.soldout .thumb img { filter: grayscale(.85) brightness(.6); }

/* ---------- Nút, form ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 11px; border: 1px solid transparent; font-weight: 700; font-size: .93rem; cursor: pointer; background: var(--card2); color: var(--text); font-family: inherit; line-height: 1.2; white-space: nowrap; }
.btn:hover { filter: brightness(1.12); color: #fff; }
.btn-primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #38bdf8)); color: #fff; }
.btn-ok { background: var(--ok); color: #04210f; }
.btn-warn { background: var(--warn); color: #2a1a00; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 6px 10px; font-size: .82rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
button.linkish { background: none; border: 0; cursor: pointer; font: inherit; }
input, select, textarea { width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: .95rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: 2px; height: 42px; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: #dcdcdc; }
.field { margin-bottom: 14px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }

/* ---------- Card / panel ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.row > .card + .card { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title h2, .card-title h3 { margin: 0; }
.auth-box { max-width: 420px; margin: 40px auto; }
.page-head { margin: 22px 0 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--card2); border: 1px solid var(--line); color: var(--text); white-space: nowrap; }
.b-ok { background: rgba(34, 197, 94, .15); border-color: rgba(34, 197, 94, .4); color: #86efac; }
.b-warn { background: rgba(245, 158, 11, .15); border-color: rgba(245, 158, 11, .4); color: #fcd34d; }
.b-bad { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .4); color: #fca5a5; }
.b-info { background: rgba(56, 189, 248, .15); border-color: rgba(56, 189, 248, .4); color: #7dd3fc; }
.b-hot { background: linear-gradient(135deg, #f43f5e, #f59e0b); border: 0; color: #fff; }
.b-primary { background: var(--primary); border: 0; color: #fff; }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--card2); color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
.num { text-align: right; white-space: nowrap; }
.plus { color: #86efac; } .minus { color: #fca5a5; }

/* ---------- Flash ---------- */
.flash { padding: 12px 14px; border-radius: 12px; margin: 14px 0; border: 1px solid; font-weight: 600; }
.flash-success { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .4); color: #bbf7d0; }
.flash-danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .4); color: #fecaca; }
.flash-warning { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .4); color: #fde68a; }
.flash-info { background: rgba(56, 189, 248, .12); border-color: rgba(56, 189, 248, .4); color: #bae6fd; }

/* ---------- Chi tiết sản phẩm ---------- */
.detail { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; margin-top: 18px; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.gallery-main { border-radius: var(--radius); overflow: hidden; background: var(--card2); aspect-ratio: 16/10; border: 1px solid var(--line); }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs img { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; opacity: .7; }
.thumbs img.on, .thumbs img:hover { border-color: var(--primary); opacity: 1; }
.buybox .price { font-size: 2rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 14px 0; font-size: .95rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.richtext { white-space: pre-wrap; word-wrap: break-word; color: #dcdcdc; }

/* ---------- Đơn thuê ---------- */
.order-card { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: center; }
.order-card img { width: 110px; height: 72px; object-fit: cover; border-radius: 10px; }
@media (max-width: 680px) { .order-card { grid-template-columns: 1fr; } .order-card img { width: 100%; height: 140px; } }
.cred { background: var(--bg2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; display: grid; gap: 6px; }
.cred .line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cred .val { font-family: ui-monospace, Consolas, monospace; background: var(--card2); padding: 3px 8px; border-radius: 6px; word-break: break-all; }
.countdown { font-family: ui-monospace, Consolas, monospace; font-weight: 800; font-size: 1.15rem; }
.countdown.low { color: var(--warn); }

/* ---------- Nạp tiền ---------- */
.deposit-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .deposit-grid { grid-template-columns: 1fr; } }
.qr-box { background: #fff; border-radius: var(--radius); padding: 10px; }
.copy { cursor: pointer; }

/* ---------- Footer ---------- */
.footer { margin-top: 50px; border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .9rem; }
.footer .container { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.floating-contact { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 40; }
.floating-contact a { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); font-size: 13px; }
.fc-zalo { background: #0068ff; } .fc-fb { background: #1877f2; } .fc-phone { background: var(--ok); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal.open { display: flex; }
.modal .box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); max-width: 480px; width: 100%; padding: 20px; max-height: 90vh; overflow: auto; }

/* Mua nhanh không cần đăng nhập */
.guest-buy { z-index: 120; }
.guest-buy h3 { margin-top: 0; }
.gb-qr { background: #fff; border-radius: 12px; padding: 8px; max-width: 260px; margin: 0 auto 6px; }
.gb-qr img { display: block; width: 100%; height: auto; }
.gb-kv { margin: 12px 0; }
.gb-kv dd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; word-break: break-all; }
.gb-code { color: var(--warn); font-size: 1.1rem; letter-spacing: 1px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.gb-wait { display: flex; gap: 10px; align-items: center; background: var(--bg2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.gb-spin { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: gbspin 1s linear infinite; }
@keyframes gbspin { to { transform: rotate(360deg); } }
.gb-warn { background: color-mix(in srgb, var(--bad) 18%, transparent); border: 2px solid var(--bad); color: #fecaca; border-radius: 10px; padding: 12px 14px; font-weight: 800; line-height: 1.5; margin: 10px 0 14px; }
.gb-cred { background: var(--bg2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.gb-cred .gb-kv { margin: 4px 0 0; }

.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .right { text-align: right; } .center { text-align: center; }
.stack > * + * { margin-top: 16px; }

/* ================= ADMIN ================= */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 4px 8px 16px; }
.sidebar a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .92rem; margin-bottom: 2px; }
.sidebar a:hover, .sidebar a.active { background: var(--card2); color: #fff; }
.sidebar a.active { box-shadow: inset 3px 0 0 var(--primary); }
.sidebar .sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .8px; color: #7d7d7d; margin: 14px 12px 6px; }
.admin-main { padding: 20px 24px 40px; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 10px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .k { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat .v { font-size: 1.45rem; font-weight: 800; margin-top: 4px; }
.stat .s { font-size: .8rem; color: var(--muted); }
.bars { display: flex; gap: 6px; align-items: flex-end; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .bar i { display: block; width: 100%; background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 40%, transparent)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bars .bar span { font-size: .68rem; color: var(--muted); }
.thumb-sm { width: 64px; height: 42px; object-fit: cover; border-radius: 8px; background: var(--card2); }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
details.act > summary { list-style: none; cursor: pointer; }
details.act > summary::-webkit-details-marker { display: none; }
details.act[open] { background: var(--bg2); border-radius: 10px; padding: 8px; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: none; }
  .sidebar.open { display: block; }
  .admin-main { padding: 16px; }
}

/* ---------- Trang sản phẩm: thanh mua dính đáy trên điện thoại ---------- */
.buybar { display: none; }
@media (max-width: 860px) {
  .buybar { display: flex; align-items: center; gap: 14px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--bg2); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + var(--safe-b)); }
  .buybar .price { font-size: 1.2rem; white-space: nowrap; }
  .buybar > form, .buybar > .btn { flex: 1; }
  body.has-buybar { padding-bottom: calc(72px + var(--safe-b)); }
}
.btn-lg { padding: 14px 18px; font-size: 1.02rem; min-height: 50px; }
.note { color: var(--muted); font-size: .9rem; margin: 10px 0 0; }
.link { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Nạp tiền ---------- */
.need { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border: 1px solid var(--line); border-left: 0; border-right: 0; padding: 14px 0; margin-bottom: 18px; }
.need form { flex: none; }

/* ---------- Hộp hỏi xác nhận + thông báo nhanh ---------- */
dialog.ask { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog.ask::backdrop { background: rgba(0, 0, 0, .75); }
dialog.ask p { margin: 0 0 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog.ask .ask-btns { display: flex; gap: 10px; justify-content: flex-end; }
dialog.ask .btn { min-height: 44px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); z-index: 200; background: var(--text); color: var(--bg); font-weight: 600; padding: 12px 16px; border-radius: var(--radius-s); max-width: calc(100vw - 32px); }

/* ---------- Bảng → thẻ xếp dọc trên điện thoại (nhãn cột do app.js gắn) ---------- */
@media (max-width: 700px) {
  .table-wrap.cards { border: 0; overflow: visible; }
  .cards table, .cards tbody, .cards tr, .cards td { display: block; width: 100%; }
  .cards thead { display: none; }
  .cards tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 14px; margin-bottom: 12px; }
  .cards td { position: relative; padding: 8px 0 8px 108px; min-height: 38px; text-align: left; white-space: normal; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
  .cards td.inline { display: flex; }
  .cards tr td:last-child { border-bottom: 0; }
  .cards td::before { content: attr(data-th); position: absolute; left: 0; top: 10px; width: 100px; color: var(--muted); font-size: .85rem; }
  .cards td.empty, .cards td.no-th { padding-left: 0; }
  .cards td.empty::before, .cards td.no-th::before { content: none; }
  .cards td .stack { min-width: 0 !important; }
}

/* ---------- Admin ---------- */
.todo { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 18px; }
.todo h3 { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.todo-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.todo-item:last-child { border-bottom: 0; }
.todo-item p { margin: 0; flex: 1; min-width: 0; }
.todo-item .badge { flex: none; }
@media (max-width: 560px) { .todo-item { flex-wrap: wrap; } .todo-item p { flex-basis: 60%; } }
.admin-top .menu-toggle { display: none !important; }
@media (max-width: 900px) {
  .admin-top { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: 10px 0; margin-bottom: 10px; }
  .admin-top .menu-toggle { display: grid !important; margin: 0; }
  .admin-main > .row, .admin-main form > .row { grid-template-columns: minmax(0, 1fr) !important; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); height: auto; z-index: 60; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .75); }
}
.stat .v, .num, .countdown { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation-duration: 3s !important; scroll-behavior: auto !important; } }
@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .chips { flex: none; }
  .toolbar .search input { flex: 1; }
}
/* Kho acc: khung nhập nằm trên, mỗi acc 1 hàng ngang → danh sách bên dưới đủ chỗ */
.stock-top { display: grid; gap: 16px; margin-bottom: 16px; }
.stock-top > .card { margin: 0; }
.stock-top > .stock-add { order: -1; }
.acc-row { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px; }
.acc-row textarea { min-height: 42px; }
.acc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (min-width: 901px) { .acc-row { grid-template-columns: 90px 1fr 1fr 170px 1.3fr; align-items: start; } .acc-head { padding-top: 10px; } .acc-head { flex-direction: column; align-items: flex-start; } }
@media (max-width: 860px) { body.has-buybar .floating-contact { bottom: calc(88px + var(--safe-b)); } .deposit-grid .qr-box { max-width: 260px; margin: 0 auto; } }
.stock { font-weight: 700; color: var(--ok); } .stock.out { color: var(--muted); }
.pcard .foot > .buy { flex: 1.3; min-width: 0; } .pcard .foot > .buy .btn { width: 100%; white-space: normal; }
input, select, textarea { font-size: 16px; }   /* iPhone không tự phóng to khi chạm ô nhập */
.nav a.btn { color: #fff; }

/* ---------- Menu admin (03/12/2026): nhóm rõ, có mô tả, nút nhanh ---------- */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 12px; }
.side-head .brand { padding: 4px; box-shadow: none; background: none; }
.side-close { display: none; background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
.side-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 4px 6px; }
.side-quick .btn { padding: 9px 6px; }
.sidebar a .mi { flex: none; width: 22px; text-align: center; font-size: 1.05rem; }
.sidebar a .ml { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar a .ml b { font-weight: 650; color: inherit; }
.sidebar a .ml small { font-size: .72rem; color: #808080; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar a.active .ml small { color: var(--muted); }
.sidebar .mb-badge { margin-left: auto; flex: none; }
.side-more > summary { list-style: none; cursor: pointer; }
.side-more > summary::-webkit-details-marker { display: none; }
.side-logout { color: var(--muted); padding: 9px 12px; font-weight: 600; width: 100%; text-align: left; }
.quicknav { display: none; }
@media (max-width: 900px) {
  .side-close { display: grid; place-items: center; }
  .sidebar { overflow-y: auto; }
  .sidebar a { padding: 11px 12px; }
  .quicknav { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 14px; padding-bottom: 4px; scrollbar-width: none; }
  .quicknav::-webkit-scrollbar { display: none; }
  .quicknav a { flex: none; padding: 8px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .88rem; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
  .quicknav a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
}

/* ---------- Nhật ký dạng console ---------- */
.console { background: #050505; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; font-size: .88rem; }
.console-day { position: sticky; top: 0; z-index: 1; background: #050505; padding: 10px 16px 6px; color: var(--accent-text); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--line); }
.cl { display: grid; grid-template-columns: 64px 104px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 7px 16px; border-left: 3px solid transparent; }
.cl:nth-child(even) { background: rgba(255, 255, 255, .02); }
.cl:hover { background: rgba(255, 255, 255, .05); }
.cl-t { font-family: ui-monospace, Consolas, monospace; color: #7d7d7d; font-size: .8rem; }
.cl-tag { justify-self: start; }
.cl-body { min-width: 0; overflow-wrap: anywhere; }
.cl-acc { font-weight: 700; color: var(--text); }
.cl-acc:hover { text-decoration: underline; }
.cl-st { margin-left: 6px; color: var(--muted); }
.cl-ref { margin-left: 6px; font-size: .8rem; padding: 1px 6px; border-radius: 6px; background: var(--card2); color: var(--info); }
.cl-note { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.cl-who { color: #7d7d7d; text-align: right; white-space: nowrap; }
.cl.ev-delete, .cl.ev-disable, .cl.ev-warn { border-left-color: var(--bad); }
.cl.ev-fix, .cl.ev-return, .cl.ev-acc { border-left-color: var(--warn); }
.cl.ev-release, .cl.ev-import, .cl.ev-reopen, .cl.ev-money { border-left-color: var(--ok); }
.cl.ev-rent, .cl.ev-reserve, .cl.ev-login { border-left-color: var(--info); }
@media (max-width: 700px) {
  .cl { grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; padding: 9px 12px; }
  .cl-t { grid-column: 1; } .cl-tag { grid-column: 2; }
  .cl-body, .cl-who { grid-column: 1 / -1; text-align: left; white-space: normal; }
}
.loss-alert { border-color: rgba(239, 68, 68, .55); background: linear-gradient(180deg, rgba(239, 68, 68, .08), var(--card)); }
.loss-list { margin: 0 0 6px; padding-left: 18px; }
.loss-list li { margin: 4px 0; }
.loss-week { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .88rem; }

/* ---------- Kho acc: gỡ nhanh ---------- */
.quick-rm { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-box textarea { font-family: ui-monospace, Consolas, monospace; }
:target { scroll-margin-top: 80px; }
.sidebar .side-quick a { justify-content: center; margin: 0; color: var(--text); box-shadow: none; }
.sidebar .side-quick a.btn-primary { color: #fff; }
.sidebar .side-head a.brand { margin: 0; color: var(--text); }
.sidebar .side-head a.brand:hover { background: none; }

/* =====================================================================
   GIAO DIỆN V2 (03/12/2026) — phẳng, gọn, ít trang trí.
   Nền xám than, 1 màu nhấn (--primary từ Cài đặt) dùng phẳng, bo góc nhỏ,
   icon nét mảnh thay emoji, tab gạch chân thay nút viên thuốc.
   Muốn quay lại bản cũ: xóa toàn bộ khối này.
   ===================================================================== */
:root {
  --bg: #0c0c0d;
  --bg2: #111113;
  --card: #151517;
  --card2: #1d1d20;
  --line: #26262a;
  --line2: #34343a;
  --text: #ececee;
  --muted: #9a9aa2;
  --faint: #6c6c74;
  --radius: 8px;
  --radius-s: 6px;
  --ok: #3fb96f;
  --warn: #d9a23a;
  --bad: #e5534b;
  --info: #5aa9e6;
  --accent-text: color-mix(in srgb, var(--primary) 35%, #fff);
}
body { font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14.5px; letter-spacing: -.005em; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { letter-spacing: -.02em; font-weight: 650; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
::selection { background: color-mix(in srgb, var(--primary) 45%, transparent); }
.ic { flex: none; vertical-align: -3px; }

/* Nút: phẳng, 1 màu, không gradient / không phát sáng */
.btn { border-radius: var(--radius-s); font-weight: 600; padding: 9px 14px; gap: 7px; border: 1px solid var(--line2); background: var(--card2); transition: background .12s, border-color .12s; }
.btn:hover { filter: none; background: #26262a; border-color: #45454c; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #fff); border-color: transparent; }
.btn-ok { background: transparent; border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: #7fd8a0; }
.btn-warn { background: transparent; border-color: color-mix(in srgb, var(--warn) 55%, transparent); color: #e8c27a; }
.btn-bad { background: transparent; border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: #f29b95; }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.btn-warn:hover { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.btn-bad:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.btn-ghost { background: transparent; border-color: var(--line2); }
.btn-sm { padding: 5px 10px; font-size: .8rem; border-radius: var(--radius-s); }
.btn-lg { min-height: 46px; }
input, select, textarea { border-radius: var(--radius-s); background: var(--bg); border-color: var(--line2); }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--primary) 70%, #fff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent); }
label { color: #c9c9ce; font-weight: 550; }

/* Thẻ / khung */
.card, .stat, .todo, .pcard, .table-wrap, .console, .modal .box, dialog.ask { border-radius: var(--radius); border-color: var(--line); }
.card { padding: 18px 20px; }

/* Tab / chip: gạch chân thay viên thuốc */
.tabs, .chips { gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.chip { border: 0; border-radius: 0; background: none; padding: 9px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 550; white-space: nowrap; }
.chip:hover { background: none; color: var(--text); }
.chip.active { background: none; color: var(--text); border-bottom-color: var(--primary); }

/* Badge */
.badge { border-radius: 4px; font-weight: 600; font-size: .74rem; padding: 2px 7px; background: var(--card2); border-color: var(--line2); color: #cfcfd4; }
.b-ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: #8ad9a8; }
.b-warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: #e6c385; }
.b-bad { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: #f0a29c; }
.b-info { background: color-mix(in srgb, var(--info) 12%, transparent); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: #9cc9ee; }
.b-primary { background: color-mix(in srgb, var(--primary) 18%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent); color: var(--accent-text); }
.b-hot { background: var(--bad); }
.plus { color: #8ad9a8; } .minus { color: #f0a29c; }

/* Bảng */
th { background: transparent; color: var(--faint); font-size: .72rem; letter-spacing: .06em; font-weight: 600; border-bottom-color: var(--line2); }
th, td { padding: 11px 14px; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
.table-wrap { background: var(--card); }

/* Thông báo */
.flash { border-radius: var(--radius-s); font-weight: 500; border-width: 1px; border-left-width: 3px; background: var(--card); }
.flash-success { border-color: var(--line); border-left-color: var(--ok); color: var(--text); }
.flash-danger { border-color: var(--line); border-left-color: var(--bad); color: var(--text); }
.flash-warning { border-color: var(--line); border-left-color: var(--warn); color: var(--text); }
.flash-info { border-color: var(--line); border-left-color: var(--info); color: var(--text); }

/* ---- Trang khách ---- */
.topbar { background: rgba(12, 12, 13, .9); }
.brand { font-weight: 700; letter-spacing: -.02em; }
.brand .dot { background: var(--card2); border: 1px solid var(--line2); border-radius: var(--radius-s); color: var(--text); }
.nav a, .nav button.linkish { border-radius: var(--radius-s); font-weight: 550; display: inline-flex; align-items: center; gap: 7px; }
.nav a:hover, .nav a.active { background: var(--card2); }
.wallet-pill { background: var(--card2); border: 1px solid var(--line2); }
.notice { background: var(--card); border-radius: var(--radius); border-left: 3px solid var(--primary); }
.notice-ic { color: var(--accent-text); display: grid; }
.hero { padding: 34px 0 6px; }
.hero h1 { font-size: 2.1rem; font-weight: 700; letter-spacing: -.035em; max-width: 18ch; }
.hero h1 span { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--accent-text); }
.hero p { max-width: 60ch; }
.pcard { transition: border-color .15s; }
.pcard:hover { transform: none; box-shadow: none; border-color: var(--line2); }
.pcard .name { font-weight: 600; }
.price { font-weight: 700; letter-spacing: -.02em; }
.soldout .thumb img { filter: grayscale(1) brightness(.45); }
.floating-contact a { border-radius: 10px; box-shadow: none; }
@media (max-width: 760px) { .hero h1 { font-size: 1.6rem; } }

/* ---- Admin ---- */
.admin { grid-template-columns: 248px 1fr; }
.sidebar { background: var(--bg2); padding: 14px 10px; }
.sidebar a { border-radius: var(--radius-s); padding: 7px 10px; gap: 11px; font-weight: 550; color: #a9a9b0; }
.sidebar a:hover { background: var(--card2); color: var(--text); }
.sidebar a.active { background: var(--card2); color: #fff; box-shadow: none; }
.sidebar a.active .mi { color: var(--accent-text); }
.sidebar a .mi { width: 18px; display: grid; place-items: center; color: var(--faint); }
.sidebar a:hover .mi { color: var(--text); }
.sidebar a .ml small { color: var(--faint); font-size: .7rem; }
.sidebar .sec { color: var(--faint); font-size: .66rem; letter-spacing: .09em; margin: 16px 10px 6px; }
.side-quick .btn { font-size: .8rem; }
.side-logout { display: flex; gap: 11px; align-items: center; padding: 7px 10px; }
.side-logout .mi { width: 18px; display: grid; place-items: center; color: var(--faint); }
.side-close { border-radius: var(--radius-s); width: 34px; height: 34px; }
.admin-main { padding: 22px 28px 48px; }
.admin-top h1 { font-size: 1.35rem; }
.admin-top .who { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.stat { padding: 14px 16px; }
.stat .k { font-size: .76rem; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .v { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; }
.todo h3 { font-size: .95rem; }
.todo-item .badge { min-width: 62px; justify-content: center; }
.quicknav a { border-radius: var(--radius-s) !important; }
.quicknav a.active { background: var(--card2) !important; border-color: var(--line2) !important; color: #fff !important; box-shadow: inset 0 -2px 0 var(--primary); }
.locked { display: inline-flex; gap: 6px; align-items: center; color: var(--faint); font-size: .82rem; white-space: nowrap; }
.console { background: var(--bg); }
.console-day { background: var(--bg); color: var(--faint); letter-spacing: .08em; }
.cl { border-left-width: 2px; }
.loss-alert { background: var(--card); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
@media (max-width: 900px) { .admin-main { padding: 14px; } }

/* ---- Menu admin gọn (03/12/2026): 1 dòng / mục, mô tả chỉ hiện ở mục đang mở (rê chuột xem gợi ý) ---- */
.sidebar a { padding: 6px 10px; margin-bottom: 1px; min-height: 34px; }
.sidebar a .ml small { display: none; }
.sidebar a.active .ml small { display: block; }
.sidebar .sec { margin: 14px 10px 4px; }
.side-quick { margin-bottom: 10px; }
.sidebar hr { border: 0; border-top: 1px solid var(--line); margin: 12px 4px; }

/* ---- Log máy chủ ---- */
.srv-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--radius); background: var(--card); margin-bottom: 14px; }
.srv-head.bad { border-left-color: var(--bad); }
.srv-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.srv-head small { color: var(--muted); }
.srv-dot, .svc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.srv-head.bad .srv-dot { background: var(--bad); }
.srv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.srv-card h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 10px; font-weight: 600; }
.svc { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.svc li { display: grid; grid-template-columns: 9px 1fr auto; column-gap: 10px; align-items: center; }
.svc li small { grid-column: 2; grid-row: 2; color: var(--faint); font-size: .72rem; }
.svc li b { grid-column: 3; grid-row: 1 / span 2; font-size: .8rem; font-weight: 600; }
.svc-dot.s-inactive, .svc-dot.s-failed { background: var(--bad); }
.svc-dot.s-unknown, .svc-dot.s-activating { background: var(--faint); }
b.s-active { color: #8ad9a8; } b.s-inactive, b.s-failed { color: #f0a29c; } b.s-unknown { color: var(--faint); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.kv dd.full { grid-column: 1 / -1; margin-top: -2px; }
.meter { height: 4px; background: var(--card2); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter i.mid { background: var(--warn); } .meter i.hi { background: var(--bad); }
.srv-access { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.srv-access .codes { display: flex; gap: 16px; margin-top: 4px; font-size: .9rem; }
.srv-access .ips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.srv-access .ips a { font-size: .78rem; padding: 2px 8px; border: 1px solid var(--line2); border-radius: 4px; color: var(--muted); }
.srv-access .ips a:hover { color: var(--text); border-color: var(--faint); }
.srv-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.srv-filter input { max-width: 280px; }
.srv-filter select { max-width: 170px; }
.srv-filter .btn { margin: 0; }
.srv-file { margin-left: auto; }
.slog { max-height: 70vh; overflow-y: auto; }
.sl { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 4px 16px; border-left: 2px solid transparent; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; line-height: 1.5; }
.sl:hover { background: rgba(255, 255, 255, .04); }
.sl-b { white-space: pre-wrap; overflow-wrap: anywhere; color: #c9c9ce; }
.sl.l-error { border-left-color: var(--bad); } .sl.l-error .sl-b { color: #f0a29c; }
.sl.l-warn { border-left-color: var(--warn); } .sl.l-warn .sl-b { color: #e6c385; }
.sl.l-ok { border-left-color: var(--ok); }
.cl-empty { padding: 18px 16px; color: var(--muted); }
@media (max-width: 760px) { .srv-access { grid-template-columns: 1fr; gap: 12px; } .srv-file { margin-left: 0; width: 100%; } .sl { grid-template-columns: 1fr; gap: 0; padding: 6px 12px; } }

/* ---- Nâng cấp toàn trang (03/12/2026) ---- */
.stat-grid.stat-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .stat-grid.stat-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tabs.jump { position: sticky; top: 0; z-index: 5; background: var(--bg); margin-bottom: 14px; }
[id] { scroll-margin-top: 56px; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 12px 0; margin-top: 14px; background: linear-gradient(transparent, var(--bg) 35%); }
.save-bar .btn { margin: 0; min-width: 160px; }
@media (max-width: 760px) { .save-bar span { display: none; } .save-bar .btn { width: 100%; } }
.empty { color: var(--muted); text-align: center; padding: 28px 14px; }
.thumb-sm { background: var(--card2); }
.card h3 { margin-top: 0; }
.hero.hero-2 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; padding: 40px 0 26px; }
.hero.hero-2 h1 { max-width: 20ch; font-size: 2.2rem; line-height: 1.15; }
.how { list-style: none; counter-reset: s; margin: 0; padding: 6px 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.how li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; padding: 12px 16px; }
.how li + li { border-top: 1px solid var(--line); }
.how li::before { content: counter(s); grid-row: 1 / span 2; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line2); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--accent-text); }
.how b { font-weight: 600; }
.how small { color: var(--muted); }
.line .ic { color: var(--faint); margin-right: 6px; }
.fc-phone .ic, .menu-toggle .ic { width: 20px; height: 20px; }
@media (max-width: 860px) { .hero.hero-2 { grid-template-columns: 1fr; gap: 20px; padding: 24px 0 14px; } .hero.hero-2 h1 { font-size: 1.6rem; } }

