/* Hunter KOC: dùng chung bộ màu và khung của Hunter Ad Library (mực ấm #191815, đỏ Hunter, font Barlow, sidebar tối). */
:root {
  --avatar-1: #be2437; --avatar-2: #a34e0d; --avatar-3: #806400; --avatar-4: #147544; --avatar-5: #16746b; --avatar-6: #2f5fe0; --avatar-7: #5145bd; --avatar-8: #8438a7; --avatar-9: #b22b70; --avatar-10: #6b6458;
  /* Separate readable accent text from solid brand actions. */
  --action: #cc2438; --action-hover: #b51d30; --action-active: #9e192b; --on-action: #ffffff;
  --accent-on-dark: #ff7a88; --control-line: #898276; --focus: #be2437;
  --inverse-bg: #191815; --inverse-ink: #ffffff; --inverse-line: #605a50;
  --overlay: rgba(0,0,0,.65); --media-bg: #0b0a09; --qr-bg: #ffffff;

  /* Chuẩn Hunter: mực ấm #191815, đỏ #ed3345, kem #faf8f3, đường kẻ #ece6da (giống trang Về Hunter, Works). */
  --red: #be2437; --red-2: #b51d30; --red-soft: #fdeced; --red-glow: rgba(237,51,69,.28);
  --ink: #191815; --ink-2: #47443d; --muted: #6c665d; --faint: #898276;
  --line: #ece6da; --line-2: #f2eee5; --line-strong: #ddd5c4; --bg: #faf8f3; --card: #fff; --card-2: #f7f4ed; --hover: #f6f2ea;
  --side: #191815; --side-2: #26241f; --side-ink: #d9d4c8; --side-muted: #b0a99c; --side-line: #2f2c26;
  --hero: #191815; --hero-ink: #f6f2ea; --hero-muted: #a9a294;
  --ok: #147544; --ok-soft: #e4f3ea; --gold: #915900; --gold-soft: #fbf0d8; --blue: #2f5fe0; --blue-soft: #e9efff; --violet: #6b3fd6; --violet-soft: #efe8ff;
  --orange: #a34e0d; --orange-soft: #fcefe3; --media: #ece8df; --cta-btn: #e8e3d8; --chip-off: #efebe2;
  --ai-bg: #f7f5ff; --ai-line: #e4e0f6; --note-bg: #fffdf5; --glow: #fde3e6;
  --r: 14px; --shadow: 0 1px 2px rgba(25,24,21,.05), 0 8px 24px rgba(25,24,21,.07); --shadow-2: 0 14px 44px rgba(25,24,21,.2);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --red: #ff7a88; --control-line: #81796c; --focus: #ff7a88;
  --red-soft: rgba(237,51,69,.16); --ink: #f3efe6; --ink-2: #c4beb1; --muted: #b0a99c; --faint: #a39b8e;
  --line: #454037; --line-2: #262420; --line-strong: #3d3a33; --bg: #12110f; --card: #1b1a17; --card-2: #211f1b; --hover: #24221e;
  --side: #0d0c0b; --side-2: #1c1a17; --side-line: #24221e; --hero: #0d0c0b;
  --media: #0b0a09; --cta-btn: #2e2b26; --chip-off: #26241f;
  --ok: #3ccf82; --ok-soft: rgba(60,207,130,.14); --gold: #e8ad45; --gold-soft: rgba(232,173,69,.15); --blue: #7f9dff; --blue-soft: rgba(127,157,255,.15);
  --violet: #b9a0ff; --violet-soft: rgba(185,160,255,.15); --orange: #f29a52; --orange-soft: rgba(242,154,82,.14);
  --ai-bg: rgba(127,157,255,.08); --ai-line: rgba(127,157,255,.22); --note-bg: #1f1d16; --glow: rgba(237,51,69,.18);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35); --shadow-2: 0 12px 44px rgba(0,0,0,.6);
  color-scheme: dark;
}
:root[data-theme="dark"] .btn.dark, :root[data-theme="dark"] .chip.on, :root[data-theme="dark"] .dd.active > .pill { background: #f3efe6; border-color: #f3efe6; color: #191815; }
:root[data-theme="dark"] .dd.active > .pill b, :root[data-theme="dark"] .dd.active > .pill .caret { color: #191815; }
:root[data-theme="dark"] .play span { background: rgba(0,0,0,.6); }
.theme-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 10px; height: 38px; min-width: 38px; padding: 0 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.theme-btn:hover { border-color: var(--line-strong); color: var(--ink); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Barlow, system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- Khung app ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { --red: var(--accent-on-dark); position: sticky; top: 0; height: 100vh; background: radial-gradient(260px 200px at 0 0, var(--red-glow), transparent 70%), var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px 12px; overflow-y: auto; }
.side-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; padding: 0 8px 18px; }
.side-logo img { width: 34px; height: 34px; object-fit: contain; }
.side-logo b { display: block; font-size: 19px; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.side-logo small { display: block; font-size: 9.5px; font-weight: 600; letter-spacing: .14em; color: var(--side-muted); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-label { margin: 16px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; text-decoration: none; font-weight: 600; font-size: 14.5px; color: var(--side-ink); }
.side-nav a:hover { background: var(--side-2); color: #fff; }
.side-nav a.on { background: var(--action); color: #fff; }
.side-nav a .count { margin-left: auto; font-size: 12px; opacity: .75; font-weight: 600; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 4px; border-top: 1px solid var(--side-line); margin-top: 12px; font-size: 13px; }
.side-user { color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-out { background: transparent; border: 1px solid var(--side-line); color: var(--side-ink); border-radius: 8px; padding: 5px 10px; cursor: pointer; text-decoration: none; }
.side-out:hover { border-color: var(--side-muted); color: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 28px; min-height: 56px; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--card); border-radius: 9px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
.top-stats { margin-left: auto; display: flex; gap: 18px; color: var(--muted); font-size: 13px; align-items: center; }
.top-stats b { color: var(--ink); }
main { padding: 4px 28px 64px; max-width: 1500px; width: 100%; }

/* ---------- Thành phần chung ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 27px; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 820px; }
.kicker { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin: 0 0 6px; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
.btn:hover { border-color: var(--line-strong); background: var(--hover); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.btn.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn.small { padding: 6px 12px; font-size: 13.5px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .seg a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.link-btn { border: 0; background: none; color: var(--red); font-weight: 600; cursor: pointer; padding: 4px 6px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 10px; font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel h2 small { font-weight: 500; font-size: 13px; color: var(--muted); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.small { font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.notice { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px; }
.notice.warn { background: var(--gold-soft); color: var(--gold); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--blue-soft); color: var(--blue); }
.badge { display: inline-block; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.red { background: var(--red-soft); color: var(--red); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--inverse-bg); color: var(--inverse-ink); border: 1px solid var(--inverse-line); padding: 11px 18px; border-radius: 12px; z-index: 99; font-weight: 600; box-shadow: var(--shadow-2); max-width: calc(100vw - 32px); }
.toast.bad { background: #b4232f; border-color: #b4232f; color: #fff; }

/* Ô số */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; }
.stat b { display: block; font-size: 28px; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat .bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.stat .bar i { display: block; height: 100%; background: var(--action); border-radius: 99px; }

/* Phễu */
.funnel { display: grid; gap: 8px; }
.f-row { display: grid; grid-template-columns: 190px 1fr 70px; gap: 12px; align-items: center; font-size: 14px; }
.f-track { height: 22px; background: var(--line-2); border-radius: 0 6px 6px 0; }
.f-fill { display: block; height: 100%; background: var(--ink-2); border-radius: 0 6px 6px 0; min-width: 2px; }
.f-row.lead .f-fill { background: var(--action); }
.f-row b { text-align: right; font-variant-numeric: tabular-nums; }

/* Bảng */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; white-space: nowrap; background: var(--card-2); }
th button { all: unset; cursor: pointer; }
th button:hover { color: var(--ink); }
th button.on { color: var(--red); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
tr.pick { background: var(--red-soft); }
.who { display: flex; align-items: center; gap: 10px; min-width: 220px; text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.who img, .ava { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--line-2); flex: none; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.who b { display: block; font-size: 14.5px; }
.who small { color: var(--muted); }
.score { display: inline-grid; place-items: center; min-width: 38px; height: 26px; border-radius: 7px; font-weight: 800; font-size: 13.5px; background: var(--line-2); }
.score.hi { background: var(--ok-soft); color: var(--ok); }
.score.mid { background: var(--gold-soft); color: var(--gold); }

/* Bộ lọc */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filters label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.filters select, .filters input, .field input, .field select, .field textarea { border: 1px solid var(--control-line); background: var(--card); border-radius: 9px; padding: 8px 10px; min-width: 0; }
.filters input[type=number] { width: 110px; }
.filters input[type=search] { width: 220px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.seg a { text-decoration: none; color: var(--ink-2); border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13.5px; }
.seg a.on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.bulk { position: sticky; bottom: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--inverse-bg); color: var(--inverse-ink); padding: 10px 14px; border-radius: 12px; margin-top: 12px; box-shadow: var(--shadow-2); }
.bulk select, .bulk input { border-radius: 8px; padding: 6px 8px; border: 0; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 14px; }

/* Biểu mẫu */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 700; font-size: 14px; }
.field small { color: var(--muted); }
.field textarea { min-height: 120px; font-family: inherit; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* Ngăn kéo hồ sơ */
.modal { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: none; justify-content: flex-end; }
.modal.open { display: flex; }
.modal-panel { position: relative; width: min(760px, 100%); height: 100%; background: var(--bg); overflow-y: auto; box-shadow: var(--shadow-2); padding: 22px 24px 40px; }
.modal-close { position: sticky; float: right; top: 0; z-index: 2; border: 1px solid var(--line); background: var(--card); width: 38px; height: 38px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.p-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; padding-right: 48px; }
.p-head img, .p-head .ava { width: 64px; height: 64px; font-size: 22px; }
.p-head h2 { margin: 0; font-size: 22px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.bio { white-space: pre-wrap; background: var(--card-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }
.vids { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.vid { text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 12.5px; }
.vid .cover { aspect-ratio: 9/16; background: var(--media) center/cover no-repeat; position: relative; }
.vid .cover span { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.7); color: #fff; padding: 2px 6px; border-radius: 6px; font-weight: 700; }
.vid .cover em { position: absolute; right: 6px; top: 6px; font-style: normal; background: var(--action); color: #fff; padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.vid p { margin: 6px 8px 8px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* Đăng nhập */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% -10%, var(--glow) 0, transparent 60%), var(--bg); }
.login-card { position: relative; width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.login-card .theme-btn { position: absolute; right: 14px; top: 14px; }
.login-logo { width: 150px; display: block; margin: 0 auto; }
.login-card h1 { margin: 4px 0; font-size: 24px; text-align: center; }
.login-card .kicker { display: block; text-align: center; margin-top: 18px; }
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.login-card input { border: 1px solid var(--control-line); background: var(--card); border-radius: 10px; padding: 11px 12px; }
.login-card .btn { justify-content: center; padding: 12px; }

/* Màn hình nhỏ */
@media (max-width: 1100px) { .top-stats .hide-md { display: none; } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 256px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-2); }
  .side.open { transform: none; }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 16px 0; }
  main { padding: 8px 16px 56px; }
  .modal-panel { padding: 16px 16px 40px; }
}
@media (max-width: 560px) {
  .page-head h1 { font-size: 22px; }
  .f-row { grid-template-columns: 120px 1fr 54px; font-size: 13px; }
  .kv { grid-template-columns: 110px 1fr; }
  .top-stats { gap: 10px; }
  .filters input[type=search] { width: 100%; }
  .filters label { flex: 1 1 140px; }
  .filters input[type=number] { width: 100%; }
}
