/* ============================================================
   Team AFF — UI v2
   Tokens first; every component reads tokens, so light/dark are one switch.
   ============================================================ */
:root {
  /* Palette from the ViAI robot: cobalt #1f45d6 · navy #0b1b5e · glossy white · orange stripe #f2851b */
  --bg: #f1f4fd; --surface: #fff; --surface-2: #f5f7fe; --text: #0e1633; --text-2: #303a5a; --muted: #5f6a88;
  --border: #e1e6f5; --border-strong: #cbd3ec;
  --primary: #1f45d6; --primary-hover: #1735ae; --primary-text: #fff; --primary-soft: #e9eeff;
  --accent: #f2851b; --accent-strong: #c25a00; --accent-soft: #fff1e3;
  --danger: #c4322c; --ok: #13804b; --warn: #a15c07;
  --ok-bg: #e7f6ee; --bad-bg: #fdecea; --warn-bg: #fff4e0; --info-bg: #ebf1fe;
  --side-bg: #0b1b5e; --side-text: #c3cdf2; --side-muted: #7f8cc0; --side-hover: rgba(255,255,255,.07); --side-active: rgba(255,255,255,.13);
  --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.05);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.12), 0 2px 6px rgba(16,24,40,.06);
  --ring: 0 0 0 3px rgba(31,69,214,.24);
  --radius: 14px; --radius-sm: 9px; --sidebar: 252px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080d24; --surface: #10183a; --surface-2: #151f48; --text: #e9edfb; --text-2: #c6cdea; --muted: #8d97bf;
    --border: #212c5c; --border-strong: #2d3a72;
    --primary: #6f8cff; --primary-hover: #93a9ff; --primary-text: #080d24; --primary-soft: #18235a;
    --accent: #ff9d42; --accent-strong: #ffb366; --accent-soft: #3a2410;
    --danger: #f2756d; --ok: #4cc38a; --warn: #f0b44c;
    --ok-bg: #12301f; --bad-bg: #3a1a19; --warn-bg: #362810; --info-bg: #1a2747;
    --side-bg: #060b26; --side-text: #b4bfe8; --side-muted: #66719e;
    --shadow-xs: none; --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
    --ring: 0 0 0 3px rgba(111,140,255,.32);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; line-height: 1.35; font-weight: 650; letter-spacing: -.005em; margin: 0 0 .9rem; }
h3 { font-size: .95rem; font-weight: 650; margin: 0 0 .6rem; }
strong { font-weight: 650; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .mt { margin-top: 1.25rem; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: .1rem .4rem; border-radius: 6px;
  font: .88em ui-monospace, "Cascadia Mono", Consolas, monospace; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.ico { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-weight: 800; font-size: .95rem;
  color: #fff; background: linear-gradient(135deg, #3a63f0 0%, #1f45d6 55%, #f2851b 150%); box-shadow: 0 2px 8px rgba(31,69,214,.4); }
.avatar { letter-spacing: .02em; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  font-weight: 700; font-size: .85rem; color: #fff; background: linear-gradient(135deg, #5b7cf0, #8a5cf0); }

/* ---------- Layout ---------- */
.main { padding: 20px 16px 48px; max-width: 1480px; }
.layout-staff .main { margin: 0 auto; max-width: 1200px; }
.layout-public .main { margin: 0 auto; padding: 0 16px; }

/* Sidebar (admin) */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; padding: 18px 14px; transform: translateX(-100%); transition: transform .22s ease;
  z-index: 30; overflow-y: auto; }
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar .brand { color: #fff; font-size: 1.05rem; padding: 4px 8px 14px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted);
  padding: 16px 12px 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--side-text);
  font-weight: 500; font-size: .93rem; position: relative; }
.sidebar nav a .ico { opacity: .75; }
.sidebar nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--side-active); color: #fff; }
.sidebar nav a.active .ico { opacity: 1; color: #8fb0ff; }
.sidebar nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; margin-top: 14px; }
.sidebar-foot .who { display: flex; align-items: center; gap: 10px; padding: 0 6px 10px; color: #fff; font-weight: 600; font-size: .9rem; }
.who-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot small { display: block; color: var(--side-muted); font-weight: 500; font-size: .78rem; }
.sidebar .btn-logout { color: var(--side-text); border-color: rgba(255,255,255,.12); justify-content: flex-start; }
.sidebar .btn-logout:hover { color: #fff; background: var(--side-hover); border-color: rgba(255,255,255,.2); }
.scrim { display: none; }
.sidebar.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(8,12,24,.45); z-index: 25; }
@media (min-width: 900px) {
  .sidebar { transform: none; }
  .sidebar.open { box-shadow: none; }
  .sidebar.open + .scrim { display: none; }
  .layout-admin .main { margin-left: var(--sidebar); padding: 28px 32px 56px; }
  .topbar-admin { display: none !important; }
}

/* Topbar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-staff { display: block; padding: 0 16px; }
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.topbar .brand { color: var(--text); }
.topnav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: 7px 12px; border-radius: 8px; color: var(--text-2); white-space: nowrap; font-weight: 500; font-size: .93rem; }
.topnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topnav a.active { background: var(--primary-soft); color: var(--primary); }
.topnav a.nav-cta { color: var(--accent-strong); font-weight: 650; }
.topbar-user { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-user .avatar { width: 32px; height: 32px; font-size: .8rem; }
.topbar-logout { margin: 0; }
@media (max-width: 700px) {
  .topbar-inner { gap: 6px 12px; padding: 8px 0 0; }
  .topnav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
}

/* ---------- Cards & page structure ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.card > h2:first-child, .card > .row-between:first-child h2 { margin-bottom: .9rem; }
.card.narrow { max-width: 600px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 22px; }
.page-head h1 { margin: 0; }
.page-head > .muted { font-size: .9rem; background: var(--surface); border: 1px solid var(--border); padding: 5px 12px; border-radius: 99px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list { margin: 0; padding-left: 1.2rem; } .list li { margin: .4rem 0; } .list li::marker { color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; align-items: center; }
.kv dt { color: var(--muted); font-size: .9rem; } .kv dd { margin: 0; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat span { display: block; color: var(--muted); font-size: .82rem; font-weight: 500; line-height: 1.35; }
.stat strong { font-size: 1.7rem; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: var(--text);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat small { display: block; font-size: .8rem; color: var(--muted); }
.stat .meter { margin: 6px 0 2px; }
a.stat { color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
a.stat::after { content: "→"; position: absolute; right: 16px; top: 14px; color: var(--muted); font-size: .9rem; transition: transform .15s, color .15s; }
a.stat:hover::after { color: var(--primary); transform: translateX(2px); }
a.stat > span:first-child { padding-right: 18px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: .9rem; color: var(--text-2); }
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 450; }
input, select, textarea { font: inherit; font-size: .95rem; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); min-height: 42px; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { min-height: auto; width: 18px; height: 18px; padding: 0; accent-color: var(--primary); box-shadow: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .filters input { flex: 1 1 200px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: .92rem; font-weight: 550;
  cursor: pointer; min-height: 40px; box-shadow: var(--shadow-xs); transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: color-mix(in srgb, var(--primary) 35%, var(--border-strong)); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); box-shadow: 0 1px 2px rgba(42,91,215,.3); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn-danger:hover { background: var(--bad-bg); color: var(--danger); border-color: var(--danger); }
.btn-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.btn-ok:hover { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { padding: 4px 11px; min-height: 32px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px; min-height: 38px; min-width: 38px; }
.btn-icon .ico { width: 20px; height: 20px; }
/* period switchers (7/30 ngày, Hôm nay/Tuần/Tháng) read as one segmented control */
.row-between > nav.actions, .card > nav.actions { gap: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex-wrap: nowrap; }
.row-between > nav.actions .btn, .card > nav.actions .btn { border-color: transparent; background: transparent; box-shadow: none; min-height: 28px; color: var(--muted); }
.row-between > nav.actions .btn:hover, .card > nav.actions .btn:hover { color: var(--text); }
.row-between > nav.actions .btn-primary, .card > nav.actions .btn-primary { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); border-color: var(--border); }

/* ---------- Alerts, badges, toast ---------- */
.alert { padding: 11px 14px; border-radius: 10px; border: 1px solid transparent; font-size: .92rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-error { background: var(--bad-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert-info { background: var(--info-bg); color: var(--text-2); border-color: color-mix(in srgb, var(--primary) 18%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600;
  line-height: 1.6; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge-ok, .badge-bad, .badge-warn { border-color: transparent; }
.badge-ok::before, .badge-bad::before, .badge-warn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-bad { background: var(--bad-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.toast { position: fixed; right: 20px; bottom: 20px; left: 20px; max-width: 420px; margin-left: auto; z-index: 50;
  background: #101828; color: #fff; padding: 13px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500;
  transition: opacity .4s, transform .4s; }
.toast.hide { opacity: 0; transform: translateY(8px); pointer-events: none; }

/* ---------- Tables: cards on mobile, table on desktop ---------- */
.table-wrap { padding: 0; overflow-x: auto; }
.card.table-wrap { overflow: hidden; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .72rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-2); white-space: nowrap; }
.table thead tr:first-child th:first-child { border-top-left-radius: 10px; } .table thead tr:first-child th:last-child { border-top-right-radius: 10px; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td a:not(.btn) { color: var(--text); font-weight: 550; }
.table td a:not(.btn):hover { color: var(--primary); }
.table td a.ext { color: var(--primary); font-weight: 450; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions form { margin: 0; }
@media (max-width: 700px) {
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--border); padding: 10px 0; }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 14px; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .82rem; }
  .row-actions { justify-content: flex-start; padding-top: 8px !important; }
}
.pagination { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 8px; color: var(--muted); font-size: .9rem; }

/* ---------- Layout helpers ---------- */
.cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cols > .card { margin-bottom: 0; }
.cols + .card, .cols + section { margin-top: 20px; }
.grid-2, .grid-3 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > .row-between:first-child { margin-bottom: 12px; }
.card > .row-between:first-child h2 { margin: 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .meter { margin-top: 6px; }
.card-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-link { display: block; color: var(--text); margin: 0; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: var(--shadow-lg); }
.ext, .ext-text { word-break: break-all; }
.ext-text { color: var(--muted); }

/* ---------- Charts (dataviz reference palette, slots 1–2; validated light & dark) ---------- */
:root { --series-1: #2a78d6; --series-2: #eb6834; --grid: #eceef2; --axis: #cfd4dc; }
@media (prefers-color-scheme: dark) { :root { --series-1: #3987e5; --series-2: #d95926; --grid: #222b40; --axis: #34405a; } }
.chart { margin: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-title { font-weight: 650; font-size: 1rem; }
.legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .84rem; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 10px; }
.key.k1 { background: var(--series-1); } .key.k2 { background: var(--series-2); }
.chart-scroll { overflow-x: auto; }
.chart-svg { width: 100%; height: auto; display: block; min-width: 560px; }
.chart-svg.dense { min-width: 620px; }
.chart-svg .s1 { fill: var(--series-1); } .chart-svg .s2 { fill: var(--series-2); }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { stroke: var(--axis); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); }
@media (max-width: 600px) { .chart-svg .tick { font-size: 17px; } }
.chart-svg .hit { fill: var(--text); opacity: 0; }
.chart-svg .hit:hover { opacity: .05; }
.table-view { margin-top: 10px; } .table-view summary { cursor: pointer; color: var(--muted); font-size: .85rem; width: max-content; }
.table-view summary:hover { color: var(--primary); }
.table-view[open] .table { margin-top: 8px; }
.meter { height: 6px; border-radius: 99px; background: var(--grid); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--series-1); }
.w-0{width:0}.w-10{width:10%}.w-20{width:20%}.w-30{width:30%}.w-40{width:40%}.w-50{width:50%}
.w-60{width:60%}.w-70{width:70%}.w-80{width:80%}.w-90{width:90%}.w-100{width:100%}

/* ---------- Video forms & results ---------- */
textarea.links { min-height: 180px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88rem; line-height: 1.6; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.warn-text { color: var(--warn); font-size: .84rem; }
.bulkbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bulkbar input[name=note] { flex: 1 1 220px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 10px 0 10px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; position: relative; }
.history li::before { content: ""; position: absolute; left: 0; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.history li:last-child { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.link-cell { max-width: 360px; word-break: break-all; }
@media (max-width: 700px) {
  .table td[data-label]::before { flex: 0 0 auto; word-break: normal; margin-right: 8px; }
  .table td { text-align: right; }
  .table td.link-cell { display: block; text-align: left; max-width: none; }
  .table td.link-cell::before { display: block; }
  .page-head .btn { white-space: nowrap; }
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 550; font-size: .92rem; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.table-dense th, .table-dense td { padding: 7px 10px; font-size: .86rem; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mb { margin-bottom: 12px; }
.small-strong { font-size: 1.15rem !important; }

/* ---------- Auth pages ---------- */
.layout-public { background:
  radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%),
  radial-gradient(700px 420px at 100% 110%, color-mix(in srgb, #ec6a37 12%, transparent), transparent 70%), var(--bg); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 410px; margin: 10vh auto 0; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.auth-wrap .auth-card { margin: 0 auto; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 1.05rem; }
.auth-card h1 { margin-bottom: .25rem; }
.auth-card > .muted { margin: 0 0 20px; }
.auth-card .form { margin-top: 4px; }
.auth-card .btn-primary { min-height: 44px; margin-top: 4px; }
.auth-foot { margin: 18px 0 0; text-align: center; }

/* ---------- Overflow guards (found by browser test at 390px) ---------- */
.kv { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
.kv dt, .kv dd { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 560px) {
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .card { padding: 16px; }
  h1 { font-size: 1.3rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat strong { font-size: 1.35rem; }
}
select, input, textarea { max-width: 100%; }

/* ---------- Reports ---------- */
.stat .stat-of { display: inline; font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat-warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background:
  linear-gradient(180deg, color-mix(in srgb, var(--warn-bg) 70%, var(--surface)), var(--surface)); }
.stat-warn strong { color: var(--warn); }
.wd { display: inline-block; min-width: 26px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.table-report tbody tr.row-empty td { color: var(--muted); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border-strong); border-bottom: 0; }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.matrix { border-collapse: separate; border-spacing: 0; font-size: .85rem; font-variant-numeric: tabular-nums; min-width: 100%; }
.matrix th, .matrix td { padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.matrix thead th { font-size: .72rem; font-weight: 650; color: var(--muted); background: var(--surface-2); }
.matrix th[scope=row], .matrix thead th:first-child { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--surface);
  font-weight: 600; font-size: .85rem; color: var(--text); border-right: 1px solid var(--border); min-width: 140px; }
.matrix thead th:first-child { background: var(--surface-2); color: var(--muted); font-size: .72rem; }
.matrix td.zero { color: var(--danger); background: var(--bad-bg); font-weight: 600; }
.matrix td.hot { color: var(--primary); font-weight: 700; }
.matrix td.sum { font-weight: 700; background: var(--surface-2); }
.matrix tr.matrix-total th, .matrix tr.matrix-total td { font-weight: 700; background: var(--surface-2); border-bottom: 0;
  border-top: 2px solid var(--border-strong); }
.kpi-cell { display: flex; align-items: center; gap: 10px; }
.kpi-cell .meter { flex: 1; }

/* ---------- KPI ---------- */
.kpi-progress td.kcell { min-width: 110px; vertical-align: top; }
.kc-top { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.kc-of { color: var(--muted); font-size: .82rem; }
.kcell .meter { margin-top: 6px; min-width: 60px; }
.kcell.is-met .meter > span { background: var(--ok); }
.kc-flag { display: inline-block; margin-top: 4px; font-size: .7rem; font-weight: 700; padding: 0 7px; border-radius: 99px; }
.kc-flag.ok { background: var(--ok-bg); color: var(--ok); }
.kc-flag.bad { background: var(--bad-bg); color: var(--danger); }
.kv-src.kv-default { font-style: italic; color: var(--muted); }
.kv-src.kv-derived { color: var(--muted); }
.kpi-applied th.grp { text-align: center; border-bottom: 1px solid var(--border); }
.kpi-applied th.sub { text-align: right; font-size: .66rem; }
.kpi-applied tr.row-default td { background: var(--primary-soft); }
.editor-target { color: var(--primary); }
.kgroup { border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px 12px; margin: 0; min-width: 0; }
.kgroup legend { font-weight: 650; font-size: .9rem; padding: 0 6px; color: var(--text-2); }
.kgrid { display: grid; gap: 2px; }
.kgrid-row { display: grid; grid-template-columns: minmax(170px, 1.2fr) minmax(130px, 180px) 112px minmax(0, 1.4fr); gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.kgrid-row:first-child { border-top: 0; }
.kgrid-row.is-disabled { opacity: .45; }
.kgrid-label strong { display: block; font-weight: 600; font-size: .92rem; }
.kgrid-label small { color: var(--muted); font-size: .78rem; }
.kin { position: relative; display: block; }
.kin input { width: 100%; text-align: right; padding-right: 30px; font-variant-numeric: tabular-nums; }
.kin .unit { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.kin-p { display: none; }
.form label.kin, .form label.kper { display: block; margin: 0; }
.kper select { width: 100%; }
.kper-fixed { font-size: .82rem; color: var(--muted); }
.ksplit-out { font-variant-numeric: tabular-nums; line-height: 1.35; }
.ksplit-out b { color: var(--text); font-weight: 600; }
.ksplit-help { margin: 0 0 12px; }
.form label.kreplace { align-self: end; padding-bottom: 10px; }
@media (max-width: 700px) {
  .kgrid-row { grid-template-columns: minmax(0, 1fr) 112px; gap: 6px 10px; }
  .kgrid-label, .ksplit-out { grid-column: 1 / -1; }
  .kin-p { display: block; font-size: .72rem; color: var(--muted); margin-bottom: 2px; }
  .kin .unit { top: auto; bottom: 12px; transform: none; }
  .kper-fixed { align-self: end; padding-bottom: 10px; }
}
}

/* ---------- KPI tháng: popup + plan table ---------- */
.page-head .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .actions > .muted { font-size: .9rem; }
.kpi-plan-table th.grp-auto, .kpi-plan-table th.sub-auto { color: var(--primary); }
.kpi-plan-table td.auto { background: var(--primary-soft); font-weight: 600; }
dialog.modal { border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,.25)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
dialog.modal > form { padding: 20px 22px 18px; display: grid; gap: 14px; }
dialog.modal { box-sizing: border-box; overflow-x: hidden; overflow-y: auto; }
dialog.modal > form > *, .plan-grid > * { min-width: 0; }
dialog.modal select, dialog.modal input { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { margin: 0; }
.plan-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-grid input { text-align: right; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.plan-result { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; background: var(--primary-soft);
  border-radius: 12px; padding: 12px; }
.plan-result > div { display: grid; gap: 2px; text-align: center; }
.plan-result span { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.plan-result strong { font-size: 1.25rem; color: var(--primary); font-variant-numeric: tabular-nums; }
.plan-result small { font-size: .7rem; }
details.kextra > summary { cursor: pointer; list-style: none; }
details.kextra > summary::-webkit-details-marker { display: none; }
details.kextra > summary h2 { display: inline; }
details.kextra > summary::before { content: "▸"; display: inline-block; width: 18px; color: var(--muted); transition: transform .15s; }
details.kextra[open] > summary::before { transform: rotate(90deg); }
details.kextra[open] > summary { margin-bottom: 14px; }
details.kextra h3 { margin: 18px 0 0; font-size: 1rem; }
@media (max-width: 560px) {
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .plan-result { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.badge-tier-main { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-tier-sub { background: var(--surface-2); color: var(--text-2); }
fieldset.tier-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
fieldset.tier-pick legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 6px; width: 100%; }
fieldset.tier-pick small { width: 100%; }
.quota-done { color: var(--ok); font-weight: 600; margin: 4px 0 0; }
.plan-result .plan-range { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  text-align: left; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
.plan-result .plan-range span { text-transform: none; letter-spacing: 0; font-size: .85rem; }
.plan-dates small { display: block; margin-top: 2px; }

/* ---------- Link AFF ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav-dot { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; vertical-align: 1px; }
.badge-new { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.aff-p-shopee { background: #fff1ec; color: #c2410c; border-color: transparent; }
.aff-p-tiktok_shop { background: var(--surface-2); color: var(--text); }
.aff-p-lazada { background: #eef0ff; color: #2b33b8; border-color: transparent; }
@media (prefers-color-scheme: dark) { .aff-p-shopee { background: #3a1c13; color: #ff8a65; } .aff-p-lazada { background: #1f2348; color: #9aa3ff; } }
.aff-tools { display: grid; gap: 10px; margin-bottom: 14px; }
.aff-tools input[type=search] { max-width: 420px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: .84rem; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.aff-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); margin-bottom: 12px; }
.aff-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; box-shadow: var(--shadow-sm); min-width: 0; align-content: start; }
.aff-card > * { min-width: 0; }
.aff-card.is-new { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset, var(--shadow-sm); }
.aff-card.is-expired { opacity: .6; }
.aff-head h2 { margin: 0 0 4px; font-size: 1rem; }
.aff-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.aff-comment, .aff-preview { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 10px 12px; display: grid; gap: 8px; }
.aff-preview { border-style: dashed; border-color: var(--primary); background: var(--primary-soft); }
.aff-comment-h { display: flex; justify-content: space-between; gap: 8px; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.aff-comment-t { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; line-height: 1.5; }
.aff-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.aff-actions .btn-primary { flex: 1 1 auto; justify-content: center; }
.aff-url { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 6px 6px 11px; }
.aff-url code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.aff-note { font-size: .85rem; color: var(--text-2); background: var(--primary-soft); padding: 6px 10px; border-radius: 8px; }
.aff-progress { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.aff-progress .meter { flex: 1 1 120px; max-width: 220px; }
.btn.copied { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tok { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; background: var(--primary-soft); color: var(--primary); padding: 1px 6px; border-radius: 6px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.form label.person, label.person { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 99px; padding: 5px 12px 5px 8px; font-size: .86rem; font-weight: 500; cursor: pointer; margin: 0; }
label.person:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
fieldset.aff-people { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
fieldset.aff-people legend { font-weight: 650; font-size: .9rem; padding: 0 6px; }
.aff-bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--primary-soft); color: var(--primary); padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; }
.aff-bulk input[type=date] { width: auto; }
.aff-pick { position: relative; }
.aff-pick summary { cursor: pointer; list-style: none; padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-size: .84rem; }
.aff-pick summary::-webkit-details-marker { display: none; }
.aff-pick-list { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px 12px; display: grid; gap: 4px; max-height: 260px; overflow: auto; min-width: 220px; color: var(--text); }
.aff-pick-list label.check { display: flex; gap: 8px; align-items: center; font-size: .86rem; }
.aff-bulk-help { margin: 0 0 8px; }
.aff-table code, .aff-import code { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.aff-cmt-cell { white-space: pre-wrap; max-width: 260px; font-size: .84rem; overflow-wrap: anywhere; }
tr.row-bad td { background: var(--bad-bg); } tr.row-warn td { background: var(--warn-bg); }
.aff-steps { display: flex; gap: 8px; flex-wrap: wrap; font-size: .84rem; margin-bottom: 14px; }
.aff-steps span { padding: 4px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.aff-steps span.on { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-weight: 600; }
.aff-steps span.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.aff-drop { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.aff-drop .grow { flex: 1; }
.aff-drop input[type=file] { max-width: 100%; }
.aff-file { display: flex; gap: 10px; align-items: center; }
.xls { width: 34px; height: 40px; border-radius: 6px; background: #1d7044; color: #fff; display: grid; place-items: center; font-size: .62rem; font-weight: 800; }
.aff-detail { align-items: start; margin-bottom: 18px; }
.aff-assign { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.aff-assign h3 { margin: 0; font-size: .95rem; }
ul.plain { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.aff-new-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-color: var(--primary); background: var(--primary-soft); color: var(--primary); margin-bottom: 18px; }
.aff-new-card:hover { text-decoration: none; }
.narrow-wide { max-width: 860px; }
.meter span.is-full { background: var(--ok); }
.aff-table .row-actions .btn { white-space: nowrap; }
.aff-table .link-cell code { word-break: break-all; }
.aff-prod { display: grid; gap: 4px; justify-items: start; min-width: 0; }
@media (max-width: 720px) { .aff-prod { justify-items: end; text-align: right; } }

/* ---------- Channels overview ---------- */
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 10px; }
.ov-tile { display: grid; gap: 2px; align-content: start; }
.ov-tile.is-total { background: var(--primary-soft); border-color: transparent; }
.ov-tile.is-warn { background: var(--warn-bg); border-color: transparent; }
.ov-tile.is-warn .ov-big { color: var(--warn); }
.ov-lab { display: flex !important; align-items: center; gap: 6px; }
.ov-big { font-size: 1.7rem; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; justify-self: start; }
.ov-big:hover { color: var(--primary); text-decoration: none; }
.ov-tile small a { color: var(--text-2); border-bottom: 1px dotted var(--border-strong); }
.ov-tile small a:hover { color: var(--primary); text-decoration: none; }
.pdot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.p-fb { background: #1877f2; fill: #1877f2; } .p-tt { background: #111827; fill: #111827; } .p-yt { background: #e62117; fill: #e62117; } .p-ot { background: #8a94a6; fill: #8a94a6; }
@media (prefers-color-scheme: dark) { .p-tt { background: #e8ecf4; fill: #e8ecf4; } }
.ov-mix { display: block; width: 100%; height: 8px; margin: 2px 0 8px; }
.ov-subline { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 16px; }
.ov-subline a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
details.ov-staff > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details.ov-staff > summary::-webkit-details-marker { display: none; }
details.ov-staff > summary h2 { margin: 0; }
details.ov-staff > summary::after { content: "Thu gọn ▴"; font-size: .82rem; color: var(--muted); white-space: nowrap; }
details.ov-staff:not([open]) > summary::after { content: "Mở ▾"; }
details.ov-staff[open] > summary { margin-bottom: 12px; }
.ov-num { display: inline-block; padding: 1px 7px; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ov-num:hover { background: var(--primary-soft); text-decoration: none; }
.ov-zero { color: var(--muted); padding: 1px 7px; }
.ov-tot .ov-num { color: var(--text); font-weight: 700; }
.ov-name { white-space: nowrap; }
tr.ov-unassigned td { background: var(--warn-bg); }
tr.is-current td { background: var(--primary-soft); }
.ov-foot { margin: 10px 0 0; }
.ov-active { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -6px 0 12px; }
.ov-tile small span, .ov-tile small a { display: inline !important; }
@media (max-width: 700px) {
  .ov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table.ov-table tbody tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 6px; padding: 10px 2px; }
  .table.ov-table tbody td { display: block; text-align: left; padding: 0; border: 0; min-width: 0; }
  .table.ov-table td[data-label]::before { display: block; margin: 0 0 1px; font-size: .64rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .table.ov-table td.ov-name { grid-column: 1 / -1; font-size: .95rem; }
  .table.ov-table td.ov-name::before { content: none; }
  .table.ov-table .ov-num, .table.ov-table .ov-zero { padding: 0; }
}
form.filters.is-loading { opacity: .6; pointer-events: none; transition: opacity .15s; }

/* ---------- Kênh của tôi ---------- */
.mc-stats { margin-bottom: 14px; }
.mc-stat-btn { font: inherit; text-align: left; cursor: pointer; color: inherit; }
.mc-stat-btn:disabled { cursor: default; }
.mc-stat-btn.is-warn { background: var(--warn-bg); border-color: transparent; }
.mc-stat-btn.is-warn strong { color: var(--warn); }
.mc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.seg button { font: inherit; font-size: .85rem; padding: 6px 12px; border: 0; background: var(--surface); color: var(--text-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.mc-name { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.mc-name > div { min-width: 0; }
.mc-plat { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: .68rem; flex: none; }
.mc-tiktok { background: #111827; } .mc-facebook { background: #1877f2; } .mc-youtube { background: #e62117; } .mc-other { background: #8a94a6; }
@media (prefers-color-scheme: dark) { .mc-tiktok { background: #2b3446; } }
.mc-spark { width: 100%; height: 30px; display: block; }
.mc-spark rect { fill: var(--primary); opacity: .8; } .mc-spark rect.z { fill: var(--border-strong); opacity: 1; }
.mc-spark-cell { min-width: 110px; }
.mc-late { color: var(--warn); font-weight: 600; }
.mc-table tr.mc-row-behind td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.mc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; margin-bottom: 12px; }
.mc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; box-shadow: var(--shadow-sm); min-width: 0; align-content: start; }
.mc-card.is-behind { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.mc-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.mc-strong { color: var(--text-2); }
.mc-today { display: flex; align-items: center; gap: 10px; font-size: .86rem; }
.mc-today .meter { flex: 1; }
.mc-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mc-kv div { background: var(--surface-2); border-radius: 9px; padding: 7px 9px; min-width: 0; }
.mc-kv span { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-kv strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mc-last { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.mc-url { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.mc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mc-actions .btn-primary { flex: 1 1 auto; justify-content: center; }
@media (max-width: 700px) { .mc-spark-cell { min-width: 0; } .mc-table .mc-spark { max-width: 140px; } }
.mc-table .row-actions .btn { white-space: nowrap; }
@media (min-width: 701px) { .mc-table .mc-days { display: block; } }

/* ---------- Staff dashboard (Tổng quan của tôi) ---------- */
.dash-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  padding: 26px 28px; border-radius: 20px; margin-bottom: 16px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #6d8dff 0%, transparent 55%), linear-gradient(135deg, #0b1b5e 0%, #1f45d6 58%, #3a63f0 100%);
  box-shadow: 0 14px 40px rgba(31, 69, 214, .3); }
.dash-hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .07); pointer-events: none; }
.dash-hero h1 { color: #fff; font-size: 1.7rem; margin: 4px 0 6px; letter-spacing: -.02em; }
.dash-hero p { margin: 0 0 16px; color: rgba(255, 255, 255, .88); max-width: 52ch; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.dash-hero p strong { color: #fff; }
.dash-date { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .75); font-weight: 600; }
.dash-streak { background: rgba(255, 255, 255, .16); border-radius: 99px; padding: 2px 10px; font-size: .82rem; font-weight: 600; color: #fff; }
.dash-cta { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.btn-lg { padding: 10px 18px; font-size: .95rem; }
.dash-hero .btn-primary { background: #fff; color: #1e3fae; border-color: #fff; }
.dash-hero .btn-primary:hover { background: #eef3ff; }
.dash-btn-ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.dash-btn-ghost:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.dash-ring { position: relative; width: 150px; height: 150px; z-index: 1; }
.dash-ring svg { width: 100%; height: 100%; }
.dash-ring-bg { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 11; }
.dash-ring-fg { fill: none; stroke: #fff; stroke-width: 11; stroke-linecap: round; }
.dash-ring-fg.is-done { stroke: #7cf0b4; }
@media (prefers-reduced-motion: no-preference) { .dash-ring-fg { transition: stroke-dasharray .8s ease; } }
.dash-ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.dash-ring-label strong { font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.dash-ring-label small { font-size: .95rem; opacity: .8; font-weight: 600; }
.dash-ring-label span { font-size: .85rem; font-weight: 700; margin-top: 2px; }
.dash-ring-label em { font-style: normal; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; opacity: .75; margin-top: 3px; }
.dash-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.dash-q { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s; }
.dash-q:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.dash-q span { font-size: .78rem; color: var(--muted); }
.dash-q strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.dash-q.is-bad strong { color: var(--danger); } .dash-q.is-new strong { color: var(--primary); }
.dash-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.dash-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: grid; gap: 8px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.dash-kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--primary); }
.dash-kpi.is-done::before { background: var(--ok); }
.dash-kpi header { display: flex; justify-content: space-between; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.dash-kpi-num { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.dash-kpi-num strong { font-size: 2rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.dash-kpi-num span { color: var(--muted); font-size: .86rem; }
.dash-kpi p { margin: 0; font-size: .86rem; color: var(--text-2); }
.dash-kpi footer { font-size: .76rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 8px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; margin-bottom: 16px; align-items: start; }
.dash-grid > .card { margin: 0; }
.dash-todo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dash-todo li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.dash-todo li > div { flex: 1; min-width: 0; display: grid; }
.dash-todo li strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-todo li span:not(.mc-plat):not(.todo-ico) { font-size: .78rem; color: var(--muted); }
.dash-todo li.todo-warn { background: var(--warn-bg); border-color: transparent; }
.dash-todo li.todo-bad { background: var(--bad-bg); border-color: transparent; }
.dash-todo li.todo-info { background: var(--primary-soft); border-color: transparent; }
.dash-todo li.todo-done { background: var(--ok-bg); border-color: transparent; }
.dash-todo li.todo-more { background: none; border: 0; padding: 2px 4px; font-size: .84rem; }
.todo-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); font-weight: 800; flex: none; }
.todo-bad .todo-ico { color: var(--danger); } .todo-done .todo-ico { color: var(--ok); }
.dash-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.dash-ch { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--surface);
  transition: border-color .15s, box-shadow .15s; min-width: 0; }
.dash-ch:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow-sm); }
.dash-ch.is-behind { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.dash-ch-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dash-ch-body strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-ch-body span { font-size: .76rem; color: var(--muted); }
.dash-ch .mc-spark { height: 22px; margin-top: 2px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .dash-hero { grid-template-columns: minmax(0, 1fr); padding: 20px; text-align: left; }
  .dash-hero h1 { font-size: 1.35rem; }
  .dash-ring { width: 128px; height: 128px; justify-self: center; grid-row: 1; }
  .dash-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpis { grid-template-columns: minmax(0, 1fr); }
  .dash-cta .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- Báo cáo video (dán link) ---------- */
.rp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .rp-layout { grid-template-columns: minmax(0, 1fr); } }
.rp-form { display: grid; gap: 18px; padding: 22px; margin: 0; }
.rp-step { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; min-width: 0; }
.rp-step legend { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1rem; padding: 0; margin-bottom: 10px; width: 100%; }
.rp-num { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--primary); color: var(--primary-text);
  font-size: .8rem; font-weight: 800; flex: none; }
.rp-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.form label.rp-ch, label.rp-ch { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; margin: 0; border: 1.5px solid var(--border);
  border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 500; transition: border-color .15s, background .15s, box-shadow .15s; min-width: 0; }
label.rp-ch:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
label.rp-ch input { position: absolute; opacity: 0; pointer-events: none; }
label.rp-ch:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
label.rp-ch:has(input:focus-visible) { box-shadow: var(--ring); }
label.rp-ch.is-behind:not(:has(input:checked)) { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.rp-ch-body { flex: 1; min-width: 0; display: grid; }
.rp-ch-body strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-ch-body small { font-size: .76rem; color: var(--muted); }
.rp-date { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rp-date input { width: auto; flex: 0 1 200px; }
.rp-links { min-height: 170px; }
.rp-count { margin-left: auto; font-size: .8rem; font-weight: 600; color: var(--muted); }
.rp-count.is-ok { color: var(--ok); } .rp-count.is-over { color: var(--danger); }
.rp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.rp-side { display: grid; gap: 12px; position: sticky; top: 12px; }
.rp-side .card { margin: 0; }
.rp-big { display: flex; align-items: baseline; gap: 6px; margin: -4px 0 8px; }
.rp-big strong { font-size: 2.2rem; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rp-big span { color: var(--muted); font-size: .9rem; }
.rp-chlist { list-style: none; padding: 0; margin: 12px 0 8px; display: grid; gap: 6px; }
.rp-chlist li { display: flex; align-items: center; gap: 8px; font-size: .86rem; min-width: 0; }
.rp-chlist .mc-plat { width: 22px; height: 22px; font-size: .58rem; border-radius: 6px; }
.rp-chlist span:not(.mc-plat) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-chlist b { font-variant-numeric: tabular-nums; } .rp-chlist b.is-warn { color: var(--warn); }
.rp-tips ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .86rem; color: var(--text-2); }
.rp-result.is-saved { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
@media (max-width: 960px) { .rp-side { position: static; } }
@media (max-width: 700px) { .rp-form { padding: 16px; } .rp-actions { width: 100%; margin-left: 0; } .rp-actions .btn { flex: 1 1 auto; justify-content: center; } .rp-date input { flex: 1 1 160px; } }

/* ---------- Báo cáo: 2 ô chọn cách báo cáo ---------- */
.mode-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.mode-tab { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
.mode-tab:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.mode-tab.is-active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.mode-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.mode-tab.is-active .mode-ico { background: var(--primary); color: var(--primary-text); }
.mode-ico-xls { background: #e6f4ec; color: #1d7044; }
.mode-tab.is-active .mode-ico-xls { background: #1d7044; color: #fff; }
@media (prefers-color-scheme: dark) { .mode-ico-xls { background: #12301f; color: #4cc38a; } }
.mode-ico svg { width: 24px; height: 24px; }
.mode-txt { display: grid; gap: 2px; min-width: 0; }
.mode-txt strong { font-size: 1.05rem; }
.mode-txt small { font-size: .82rem; color: var(--muted); }
.mode-tab.is-active .mode-txt strong { color: var(--primary); }
.rp-auto { font-weight: 500; }
@media (max-width: 560px) { .mode-tab { padding: 12px; gap: 10px; } .mode-ico { width: 38px; height: 38px; } .mode-txt small { display: none; } }
/* channel ID (#code) */
td.ch-id { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text-2); white-space: nowrap; width: 1%; }
.ch-id-badge { display: inline-block; font-size: .72rem; font-weight: 650; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.ch-id-inline { color: var(--text-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); margin-bottom: 14px; }

/* ---------- Kiếm tiền nền tảng ---------- */
.rm-pick { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rm-pick legend { grid-column: 1 / -1; }
.form label.rm-card { display: flex; flex-direction: row; gap: 8px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; margin: 0; font-weight: 500; }
label.rm-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
label.rm-card span { display: grid; gap: 2px; } label.rm-card small { color: var(--muted); font-size: .78rem; }
@media (max-width: 640px) { .rm-pick { grid-template-columns: minmax(0, 1fr); } }
.mon-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; margin-bottom: 16px; }
.mon-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; box-shadow: var(--shadow-sm); }
.mon-card.is-todo { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.mon-card-h { display: flex; gap: 10px; align-items: center; } .mon-card-h > div { flex: 1; min-width: 0; display: grid; }
.mon-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.mon-dl div { background: var(--surface-2); border-radius: 9px; padding: 7px 9px; }
.mon-dl dt { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; } .mon-dl dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.mon-reject { margin: 0; font-size: .84rem; color: var(--danger); background: var(--bad-bg); padding: 6px 10px; border-radius: 8px; }
.mon-status-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.mon-form h3 { margin: 6px 0 0; font-size: .95rem; }
.mon-fs { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }
.mon-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.mon-rate { max-width: 220px; }
.mon-recon { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .mon-recon { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mon-recon input, .mon-rate input { text-align: right; font-variant-numeric: tabular-nums; }
.mon-formula { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: .9rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.diff-ok { color: var(--ok); font-weight: 700; } .diff-bad { color: var(--danger); font-weight: 700; }
.mon-files { display: flex; gap: 10px; flex-wrap: wrap; }
.mon-file { width: 132px; display: grid; gap: 4px; font-size: .78rem; }
.mon-file img, .mon-pdf { width: 132px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: grid; place-items: center; background: var(--surface-2); font-weight: 800; color: var(--danger); }
.mon-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form label.mon-add { height: 96px; border: 2px dashed var(--border-strong); border-radius: 10px; display: grid; place-items: center; color: var(--primary); font-weight: 650; cursor: pointer; margin: 0; text-align: center; }
.mon-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mon-actions { justify-content: flex-end; }
.mon-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mon-shot { display: grid; gap: 4px; color: var(--text); } .mon-shot img, .mon-shot .mon-pdf { width: 100%; height: 130px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.mon-shot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-detail { align-items: start; }

/* Kiếm tiền nền tảng: visible in channel list / detail / my channels */
.badge-mon { background: #fff4d6; color: #8a5a00; border-color: transparent; white-space: nowrap; }
.ov-tile.is-mon { background: #fff8e6; border-color: transparent; }
.ov-tile.is-mon .ov-big { color: #8a5a00; }
.rm-assign { margin-top: 10px; }
.mc-mon { margin-bottom: 18px; }
.mc-mon > .row-between { margin-bottom: 10px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-mon { background: #3d2e0a; color: #f5cf73; }
  :root:not([data-theme="light"]) .ov-tile.is-mon { background: #2a2210; }
  :root:not([data-theme="light"]) .ov-tile.is-mon .ov-big { color: #f5cf73; }
}
:root[data-theme="dark"] .badge-mon { background: #3d2e0a; color: #f5cf73; }
:root[data-theme="dark"] .ov-tile.is-mon { background: #2a2210; }
:root[data-theme="dark"] .ov-tile.is-mon .ov-big { color: #f5cf73; }

.mon-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mon-log > li { border-left: 3px solid var(--border); padding: 4px 0 4px 12px; display: grid; gap: 3px; }
.mon-log > li.is-edit { border-left-color: var(--warn); }
.mon-log ul { margin: 0; padding-left: 18px; }

/* Admin dashboard: first row = 6 boxes in one line on wide screens */
.stats.stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 14px; }
@media (max-width: 1280px) { .stats.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stats.stats-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Thông báo (bell) ---------- */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; color: var(--text-2); }
.bell:hover, .bell.active { background: var(--surface-2); color: var(--primary); text-decoration: none; }
.bell .ico { width: 21px; height: 21px; }
.bell-dot { position: absolute; top: 3px; right: 2px; min-width: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .64rem; font-weight: 700; line-height: 17px; text-align: center; }
.topbar-admin .bell { margin-left: auto; }
.nav-bell .nav-dot { margin-left: auto; }
.notif-list { list-style: none; margin: 0 0 12px; padding: 0; overflow: hidden; }
.notif + .notif { border-top: 1px solid var(--border); }
.notif a { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; color: inherit; }
.notif a:hover { background: var(--surface-2); text-decoration: none; }
.notif.is-unread { background: var(--primary-soft); }
.notif-ico { font-size: 1.2rem; line-height: 1.4; }
.notif-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.notif-text { color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.notif-new { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 8px; flex: none; }
.notif-table td.center, .notif-table th.center { text-align: center; }
.notif-table .input-sm { width: 120px; padding: 6px 8px; }
.tg-fields { border: 0; padding: 0; margin: 0; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span[aria-hidden] { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .15s; }
.switch span[aria-hidden]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.pick-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px; max-height: 280px; overflow: auto; padding: 8px; border: 1px solid var(--border); border-radius: 10px; }

/* ---------- Linh vật ViAI + điểm nhấn cam ---------- */
.mascot { display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #ffffff 0 55%, #e3eaff 100%); box-shadow: inset 0 0 0 1px rgba(31,69,214,.08); }
.mascot img { display: block; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.mascot-hero { width: 148px; height: 148px; align-self: end; margin-bottom: -6px; position: relative; z-index: 1;
  box-shadow: 0 10px 30px rgba(6,14,60,.35), 0 0 0 6px rgba(255,255,255,.12); animation: mascot-float 4s ease-in-out infinite; }
.dash-hero:has(.mascot-hero) { grid-template-columns: minmax(0, 1fr) auto auto; }
.mascot-head { width: 64px; height: 64px; }
.page-head-mascot { justify-content: flex-start; gap: 14px; align-items: center; }
.page-head-mascot h1 { margin: 0; }
.mascot-auth { width: 168px; height: 168px; margin: 0 auto -28px; position: relative; z-index: 1;
  box-shadow: 0 12px 30px rgba(31,69,214,.22); animation: mascot-float 4s ease-in-out infinite; }
.auth-wrap { display: grid; justify-items: center; }
.empty-mascot { display: grid; justify-items: center; gap: 6px; text-align: center; }
.empty-mascot p { margin: 0; }
.mascot-empty { width: 132px; height: 132px; animation: mascot-float 4.5s ease-in-out infinite; }
@keyframes mascot-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .mascot { animation: none !important; } }
@media (max-width: 720px) {
  .mascot-hero { display: none; }
  .dash-hero:has(.mascot-hero) { grid-template-columns: minmax(0, 1fr) auto; }
  .mascot-auth { width: 120px; height: 120px; margin-bottom: -20px; }
}
/* orange stripe = the robot's accent: active nav marker, primary hero CTA edge, brand underline */
.topnav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
.dash-hero .btn-primary { background: #fff; color: var(--primary); border-color: #fff; box-shadow: 0 0 0 0 transparent, inset 0 -3px 0 var(--accent); }
.dash-hero .btn-primary:hover { background: #f4f6ff; }
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }

.user-ch { display: inline-flex; gap: 4px; align-items: baseline; padding: 3px 10px; border-radius: 99px; background: var(--primary-soft); }
.user-ch:hover { text-decoration: none; background: var(--primary); color: var(--primary-text); }
