/* Ignite Campaign — bang dieu khien chi tieu Meta Ads
 *
 * Quy tac mau: mau bao hoa duy nhat tren man hinh la --live, va no chi co
 * mot nghia — campaign dang chay, dang tieu tien. Moi thu khac trung tinh.
 * Nho vay liec mot cai la doc duoc account nay dang dot bao nhieu.
 */

:root {
  --paper:   #FBFBF9;   /* nen app, am rat nhe de bot choi mat khi nhin ca ngay */
  --card:    #FFFFFF;
  --ink:     #14161A;   /* chu chinh */
  --slate:   #5A6270;   /* chu phu */
  --mute:    #8B92A0;   /* chu mo */
  --rule:    #E5E7EB;   /* duong ke */
  --rule-2:  #EFF0F3;   /* duong ke nhat hon, dung trong bang */
  --wash:    #F3F4F7;   /* nen hover / vung chim */
  --live:    #0E9F6E;   /* DANG CHAY - mau bao hoa duy nhat */
  --live-bg: #ECFAF4;
  --halt:    #B4342A;   /* loi va hanh dong pha huy */
  --halt-bg: #FDF0EE;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(20,22,26,.05);
  --shadow:    0 4px 14px rgba(20,22,26,.07), 0 1px 3px rgba(20,22,26,.05);
  --shadow-lg: 0 24px 60px rgba(20,22,26,.16), 0 2px 8px rgba(20,22,26,.06);

  /* them cho che do sang/toi */
  --on-ink:  #FFFFFF;   /* chu tren nen --ink */
  --bar:     #14161A;   /* thanh thao tac hang loat (luon toi) */
  --rule-3:  var(--rule-3);   /* vien khi hover */
  --sw-off:  #CDD1D8;
  --shade:   rgba(20,22,26,.05);
  --warn:    #C98A0B;
  --warn-bg: #FFF7E6;
  --warn-line: #F2D49B;
  --warn-ring: #FBE8C4;
  --c-spend: #3F6BB0;
  --c-rev:   #0E9F6E;
  --c-ink:   #2B2F36;
  --c-bad:   #B4342A;
  color-scheme: light;
}

/* Che do toi: theo he dieu hanh (khi chua chon), hoac chon tay tren thanh tren cung. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1115; --card: #171A20; --ink: #E7E9ED; --slate: #A3AAB6; --mute: #6E7683;
    --rule: #2A2F37; --rule-2: #22262D; --wash: #1F232A;
    --live: #2BBF8A; --live-bg: #12301F; --halt: #E0655A; --halt-bg: #3A1D1A;
    --on-ink: #14161A; --bar: #252A33; --rule-3: #3A404A; --sw-off: #3A404A; --shade: rgba(255,255,255,.06);
    --warn: #E0A93B; --warn-bg: #33270F; --warn-line: #6B5420; --warn-ring: #4A3912;
    --c-spend: #6E9BE3; --c-rev: #34C38F; --c-ink: #C9CDD4; --c-bad: #E0655A;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 4px 14px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.4);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1115; --card: #171A20; --ink: #E7E9ED; --slate: #A3AAB6; --mute: #6E7683;
  --rule: #2A2F37; --rule-2: #22262D; --wash: #1F232A;
  --live: #2BBF8A; --live-bg: #12301F; --halt: #E0655A; --halt-bg: #3A1D1A;
  --on-ink: #14161A; --bar: #252A33; --rule-3: #3A404A; --sw-off: #3A404A; --shade: rgba(255,255,255,.06);
  --warn: #E0A93B; --warn-bg: #33270F; --warn-line: #6B5420; --warn-ring: #4A3912;
  --c-spend: #6E9BE3; --c-rev: #34C38F; --c-ink: #C9CDD4; --c-bad: #E0655A;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 4px 14px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-rows: auto 1fr;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================ dang nhap ============================ */

.gate {
  position: fixed; inset: 0; z-index: 60;
  background: var(--paper);
  display: grid; place-items: center; padding: 24px;
}
.gate.hide { display: none; }

.gate form {
  width: 100%; max-width: 348px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 34px 32px 28px;
  box-shadow: var(--shadow);
}
.gate h1 {
  margin: 0 0 4px;
  font-size: 19px; font-weight: 600; letter-spacing: -.02em;
}
.gate h1 span { color: var(--live); }
.gate .hint { margin: 0 0 24px; color: var(--slate); font-size: 13px; }
.gate label {
  display: block; margin: 0 0 6px;
  font-size: 12px; font-weight: 500; color: var(--slate);
}
.gate input {
  width: 100%; margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.gate input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20,22,26,.07);
}
.gate button[type=submit] {
  width: 100%; margin-top: 4px;
  border: 0; border-radius: var(--r-sm);
  padding: 11px;
  background: var(--ink); color: var(--on-ink);
  font-weight: 550; letter-spacing: -.01em;
  transition: opacity .12s;
}
.gate button[type=submit]:hover { opacity: .88; }
.gate button[type=submit]:disabled { opacity: .45; cursor: wait; }
.gate .msg { margin-top: 12px; min-height: 18px; font-size: 13px; color: var(--halt); }

/* ============================== header ============================== */

header {
  display: flex; align-items: center; gap: 18px;
  height: 56px; padding: 0 18px;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-size: 15px; font-weight: 600; letter-spacing: -.025em;
  display: flex; align-items: center; gap: 8px;
}
.brand span { color: var(--live); }
.brand::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--live); box-shadow: 0 0 0 3px var(--live-bg);
}

.meta { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.who { font-size: 13px; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.who i {
  font-style: normal; font-size: 10.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--slate); background: var(--wash);
  padding: 2px 6px; border-radius: 4px;
}
#gv { font: 11.5px var(--mono); color: var(--mute); }

.usage { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--mute); }
/* thanh dau hep: an chi so phu truoc, roi cho xuong dong thay vi tran ngang */
@media (max-width: 1400px) { header #gv, header .usage { display: none; } .meta { gap: 10px; } }
@media (max-width: 1220px) { header { height: auto; min-height: 56px; flex-wrap: wrap; row-gap: 6px; padding-top: 6px; padding-bottom: 6px; } }
.bar { width: 52px; height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--live); transition: width .3s; }

.out {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 6px 11px; font-size: 12.5px; font-weight: 500; color: var(--slate);
  transition: background .12s, color .12s, border-color .12s;
}
.out:hover { background: var(--wash); color: var(--ink); border-color: var(--rule-3); }

/* ============================== layout ============================== */

.shell { display: grid; grid-template-columns: 292px 1fr; min-height: 0; }

aside {
  background: var(--card);
  border-right: 1px solid var(--rule);
  display: grid; grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}
aside .acct-list { grid-row: 3; }
main { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }

.pad { padding: 14px; }

.field { position: relative; }
.field input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 9px 12px 9px 34px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field input::placeholder { color: var(--mute); }
.field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20,22,26,.06);
}
.field::before {
  content: ""; position: absolute; left: 12px; top: 50%;
  width: 13px; height: 13px; margin-top: -7px;
  background: var(--mute);
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}

/* ------------------------- danh sach account ------------------------- */

.acct-list { overflow-y: auto; padding: 0 10px 16px; }

.group {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 8px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--mute);
}
.group b { color: var(--slate); font-weight: 600; }
.group::after {
  content: ""; flex: 1; height: 1px; background: var(--rule-2);
}

.acct {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-radius: var(--r-sm);
  padding: 9px 10px;
  margin-bottom: 1px;
  transition: background .1s;
}
.acct:hover { background: var(--wash); }
.acct.sel { background: var(--wash); box-shadow: inset 2px 0 0 var(--ink); }
.acct b {
  display: block; font-size: 13.5px; font-weight: 500; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct small {
  display: block; margin-top: 2px;
  font-size: 12px; color: var(--mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct.dead b { color: var(--slate); }
.acct.dead small { color: var(--halt); opacity: .7; }

/* ============================= thanh cong cu ============================= */

.toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.toolbar .field { flex: 1 1 260px; max-width: 420px; }

.chips {
  display: flex; gap: 2px; padding: 2px;
  background: var(--wash); border-radius: 7px;
}
.chips button {
  background: none; border: 0; border-radius: 5px;
  padding: 5px 12px;
  font-size: 12.5px; font-weight: 500; color: var(--slate);
  transition: background .12s, color .12s, box-shadow .12s;
}
.chips button:hover { color: var(--ink); }
.chips button.on {
  background: var(--card); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

select {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 7px 9px; font-size: 12.5px; color: var(--slate);
}
select:hover { border-color: var(--rule-3); }

.ghost {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 7px 13px; font-size: 12.5px; font-weight: 500;
  transition: background .12s, border-color .12s;
}
.ghost:hover { background: var(--wash); border-color: var(--rule-3); }
.ghost:disabled { opacity: .5; cursor: wait; }

.count {
  margin-left: auto;
  font-size: 12.5px; color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.lock {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--halt);
  background: var(--halt-bg); border-radius: 20px; padding: 4px 11px;
}
.lock:empty { display: none; }

/* ================================ bang ================================ */

.scroll { overflow: auto; min-height: 0; }
table { width: 100%; border-collapse: collapse; }

thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--paper);
  text-align: left; white-space: nowrap;
  padding: 11px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--mute);
  border-bottom: 1px solid var(--rule);
}
thead th.num, td.num { text-align: right; }
thead th.sort { cursor: pointer; user-select: none; }
thead th.sort:hover { color: var(--slate); }
thead th .dir { color: var(--ink); margin-left: 3px; }

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule-2);
  vertical-align: middle;
}
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--card); }

/* Rail: campaign dang chay co vach mau o mep trai. Doc ca cot mot phat
   la biet account nay dang dot bao nhieu phan. */
tbody tr td:first-child { position: relative; }
tbody tr.live td:first-child::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--live);
}
tbody tr.picked { background: var(--wash); }
tbody tr.picked td:first-child::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--ink);
}

.cname {
  font-size: 14px; font-weight: 500; letter-spacing: -.005em;
  overflow: hidden; text-overflow: ellipsis;
}
.cmeta { margin-top: 3px; font: 11.5px var(--mono); color: var(--mute); }
.issue { margin-top: 3px; font-size: 12px; color: var(--halt); }

td.num {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
td.num.spend-live { color: var(--live); font-weight: 550; }

.badge {
  font-size: 11.5px; color: var(--mute);
}
.badge.warn { color: var(--halt); }

input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--ink);
  cursor: pointer;
}

/* cong tac */
.sw {
  position: relative; width: 36px; height: 20px;
  border: 0; border-radius: 10px; padding: 0;
  background: var(--sw-off);
  transition: background .16s;
}
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .16s;
}
.sw.on { background: var(--live); }
.sw.on::after { transform: translateX(16px); }
.sw:disabled { opacity: .45; cursor: not-allowed; }

/* o budget sua duoc */
.bud {
  background: none; border: 1px solid transparent; border-radius: 5px;
  padding: 3px 7px; margin: -3px -7px;
  font-size: 13px; font-variant-numeric: tabular-nums;
  transition: background .12s, border-color .12s;
}
.bud:hover { background: var(--card); border-color: var(--rule); }
.budin {
  width: 94px;
  background: var(--card); border: 1px solid var(--ink); border-radius: 5px;
  padding: 3px 7px;
  font-size: 13px; font-variant-numeric: tabular-nums; text-align: right;
  outline: none;
  box-shadow: 0 0 0 3px rgba(20,22,26,.07);
}

.empty { padding: 72px 24px; text-align: center; }
.empty b {
  display: block; margin-bottom: 6px;
  font-size: 15px; font-weight: 550; color: var(--ink);
}
.empty { color: var(--slate); font-size: 13.5px; }

/* ==================== thanh hanh dong + trang thai ==================== */

.dock {
  background: var(--card);
  border-top: 1px solid var(--rule);
}

.bulk {
  display: none; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: var(--bar);
  color: #fff;
}
.bulk.show { display: flex; }
.bulk .spacer { flex: 1; }

/* Chu ky cua giao dien: thanh nay noi ro hau qua bang tien TRUOC khi bam. */
.bulk .stake { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.bulk .stake b {
  font-size: 14.5px; font-weight: 600; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.bulk .stake span {
  font-size: 12.5px; color: rgba(255,255,255,.62);
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.bulk .linkish {
  background: none; border: 0; padding: 4px 2px;
  font-size: 12.5px; color: rgba(255,255,255,.62);
  text-decoration: underline; text-underline-offset: 3px;
}
.bulk .linkish:hover { color: #fff; }

.bset { display: flex; gap: 7px; align-items: center; }
.bset select, .bset input {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-sm);
  padding: 7px 9px; font-size: 12.5px; color: #fff;
}
.bset select option { color: var(--ink); }
.bset input { width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.bset input::placeholder { color: rgba(255,255,255,.4); }

.act {
  border: 0; border-radius: var(--r-sm);
  padding: 8px 15px;
  font-size: 13px; font-weight: 550; letter-spacing: -.01em;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.act.on { background: var(--live); color: #fff; }
.act.on:hover { background: var(--live); filter: brightness(.92); }
.act.off { background: rgba(255,255,255,.13); color: #fff; }
.act.off:hover { background: rgba(255,255,255,.22); }
.act.armed { background: var(--halt); color: #fff; }
.act:disabled { opacity: .45; cursor: wait; }

/* dong trang thai: chi hien dong gan nhat, bam de xem lai lich su */
.statusbar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  border-top: 1px solid var(--rule-2);
  font-size: 12.5px; color: var(--slate);
}
.statusbar .dotmark {
  width: 6px; height: 6px; border-radius: 50%; background: var(--rule);
  flex: none;
}
.statusbar.ok .dotmark { background: var(--live); }
.statusbar.err .dotmark { background: var(--halt); }
.statusbar .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statusbar time { font-variant-numeric: tabular-nums; color: var(--mute); font-size: 11.5px; }
.statusbar button {
  background: none; border: 0; padding: 2px 4px;
  font-size: 12px; color: var(--mute);
}
.statusbar button:hover { color: var(--ink); }

.log {
  display: none;
  max-height: 168px; overflow-y: auto;
  padding: 6px 18px 12px;
  border-top: 1px solid var(--rule-2);
  background: var(--paper);
}
.log.show { display: block; }
.log div {
  display: flex; gap: 10px;
  padding: 3px 0;
  font-size: 12.5px; color: var(--slate);
}
.log div span { color: var(--mute); font-variant-numeric: tabular-nums; flex: none; }
.log .ok { color: var(--live); }
.log .err { color: var(--halt); }

/* ================================= CMS ================================= */

.drawer {
  position: fixed; inset: 0; z-index: 50;
  display: none;
  padding: 24px;
  overflow-y: auto;
  background: rgba(20,22,26,.34);
  backdrop-filter: blur(2px);
}
.drawer.show { display: block; }

.sheet {
  max-width: 1280px; margin: 0 auto;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 228px minmax(0, 1fr);
  min-height: calc(100vh - 48px);
  overflow: clip;
}

/* dieu huong doc, chia nhom; dinh khi cuon */
.tabs {
  display: flex; flex-direction: column; align-items: stretch; gap: 1px;
  padding: 18px 12px;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  position: sticky; top: 0; align-self: start;
  height: calc(100vh - 48px); overflow-y: auto;
}
.tabs .cms-brand { font-size: 15px; font-weight: 650; padding: 2px 10px 6px; }
.tabs .tg { padding: 14px 10px 4px; font-size: 10.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--mute); }
.tabs button[data-tab] {
  background: none; border: 0; text-align: left;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--slate);
  transition: background .12s, color .12s;
}
.tabs button[data-tab]:hover { background: var(--wash); color: var(--ink); }
.tabs button[data-tab].on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.tabs .spacer { flex: 1; min-height: 16px; }
.tabs #syncBtn { margin: 6px 4px 0; }
.cms-main { min-width: 0; padding: 0 28px 28px; }
.cms-top {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 0 14px; margin-bottom: 16px;
  background: var(--card); border-bottom: 1px solid var(--rule);
}
.cms-top h3 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
@media (max-width: 860px) {
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .tabs { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--rule); }
  .tabs .tg, .tabs .cms-brand, .tabs .spacer { display: none; }
  .cms-main { padding: 0 16px 20px; }
}

.tab { display: none; }
.tab.on { display: block; }

.hint { margin: 0 0 18px; color: var(--slate); font-size: 13px; max-width: 62ch; }

.form {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  margin-bottom: 22px;
}
.form label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 500; color: var(--slate);
}
.form input, .form select {
  width: 100%;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 8px 10px; font-size: 13px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.form input:focus, .form select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20,22,26,.06);
}
.form input:disabled { background: var(--wash); color: var(--slate); }
.form .wide { grid-column: 1 / -1; }
.form .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form .row .ghost { background: var(--card); }
.form .row > label { margin: 0; display: flex; align-items: center; gap: 7px; }
/* o tick / radio khong chiem het chieu ngang (truoc day input{width:100%} ep chu nhan thanh cot hep) */
.form input[type="checkbox"], .form input[type="radio"] { width: auto; flex: none; margin: 0; padding: 0; box-shadow: none; }
.form label.chk { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; font-weight: 450; color: var(--ink); }
.form label.inl { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; color: var(--ink); white-space: nowrap; }
.form label.inl input { width: 72px; }
.form .wide2 { grid-column: span 2; }
.form .sect { font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--slate);
  border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 2px; }
.form > .sect:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form details.adv { border: 1px dashed var(--rule-3); border-radius: var(--r-sm); padding: 10px 12px; background: var(--card); }
.form details.adv > summary { cursor: pointer; font-size: 13px; font-weight: 550; color: var(--slate); }
.form details.adv[open] > summary { margin-bottom: 4px; }
.form-in { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.form-in .wide { grid-column: 1 / -1; }
.form-in .wide2 { grid-column: span 2; }
.pk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.form .pk-bar input[type="search"] { flex: 1 1 280px; width: auto; }
.pk-count { margin-left: auto; font-size: 12px; color: var(--slate); white-space: nowrap; }
.picker.tall { max-height: 380px; }
.picker label { user-select: none; }
.picker label.on b, .picker label.on .an { color: var(--ink); }
.picker label.anchor { box-shadow: inset 0 0 0 1px var(--rule-3); }
.picker label .pk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker label .pk-meta { color: var(--mute); font-size: 12px; white-space: nowrap; }
.picker label.off .pk-name { color: var(--mute); }
.pk-tip { font-size: 12px; color: var(--mute); margin: 6px 0 0; line-height: 1.5; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--rule-3); border-bottom-width: 2px; border-radius: 4px; background: var(--card); color: var(--ink); }
.ch-out { max-height: 340px; overflow: auto; margin: 0; font: 11.5px/1.5 var(--mono); background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r-sm); padding: 10px 12px; white-space: pre-wrap; word-break: break-word; }
.ch-out[hidden] { display: none; }
.ch-pre { align-self: end; }
#tabCohort .kpis { margin-bottom: 16px; }
#tabCohort .panel { margin-bottom: 16px; }
#tabCohort .pad-h { padding: 12px 16px 0; }
.ch-err td { white-space: normal; font-size: 12px; }

.picker {
  max-height: 210px; overflow-y: auto;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 6px;
  background: var(--card);
}
.picker label {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 7px; margin: 0; border-radius: 5px;
  font-size: 13px; font-weight: 400; color: var(--ink);
  cursor: pointer;
}
.picker label:hover { background: var(--wash); }
.picker label small { color: var(--mute); font-size: 12px; }
.picker .head {
  padding: 10px 7px 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--mute);
}

.rows td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--rule-2);
  font-size: 13.5px;
}
.rows tr:hover { background: var(--paper); }
.rows .tag {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--slate); background: var(--wash);
  padding: 2px 7px; border-radius: 4px;
}
.rows .offtag {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  color: var(--halt); background: var(--halt-bg);
  padding: 2px 7px; border-radius: 4px;
}

.mini {
  background: var(--card); border: 1px solid var(--rule); border-radius: 5px;
  padding: 4px 10px; font-size: 12px; font-weight: 500; color: var(--slate);
  transition: background .12s, color .12s, border-color .12s;
}
.mini:hover { background: var(--wash); color: var(--ink); border-color: var(--rule-3); }
.mini.danger:hover { background: var(--halt-bg); color: var(--halt); border-color: var(--halt); }
.mini.armed {
  background: var(--halt); color: #fff; border-color: var(--halt);
}
.mini.armed:hover { background: var(--halt); color: #fff; filter: brightness(.9); }

.fmsg { font-size: 12.5px; min-height: 18px; color: var(--halt); }
.fmsg.ok { color: var(--live); }

.audit-when { color: var(--mute); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-act { font-size: 12px; font-weight: 500; color: var(--slate); }
.audit-act.warn { color: var(--halt); }
.audit-detail {
  color: var(--mute); font: 11.5px var(--mono);
  overflow: hidden; text-overflow: ellipsis; max-width: 380px; white-space: nowrap;
}

.raw {
  display: none;
  max-height: 340px; overflow: auto;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r);
  font: 11.5px/1.65 var(--mono); color: var(--slate);
  white-space: pre-wrap; word-break: break-word;
}
.raw.show { display: block; }

.more td {
  padding: 14px; text-align: center;
  color: var(--slate); font-size: 13px;
  background: var(--paper);
}
.more td button { margin-left: 10px; }

/* ---------------------------- so lieu Adjust ---------------------------- */

.adjstamp {
  font-size: 12px; color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.adjstamp:empty { display: none; }
.adjstamp.bad {
  color: var(--halt); background: var(--halt-bg);
  padding: 4px 10px; border-radius: 20px; font-weight: 500;
}

/* Xanh = dang co lai, do = dang lo. Cung mot quy tac mau voi phan con lai. */
td.num.good { color: var(--live); font-weight: 550; }
td.num.bad  { color: var(--halt); font-weight: 550; }

/* Chua bat Adjust thi an han 4 cot, khoi de bang day dau gach ngang. */
body.no-adjust .adj { display: none; }

/* ============================ che do chi xem ============================ */

body.ro .sw { pointer-events: none; opacity: .5; }
body.ro input[type=checkbox].campaign-pick,
body.ro .bset,
body.ro .act { display: none; }
body.ro .bud { pointer-events: none; border-color: transparent; background: none; }

/* ============================== man hep ============================== */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 210px 1fr; }
  aside { border-right: 0; border-bottom: 1px solid var(--rule); }
  .hide-sm { display: none; }
  .form { grid-template-columns: 1fr 1fr; }
  .bulk { flex-wrap: wrap; gap: 10px; }
  .bulk .spacer { display: none; }
  header { gap: 12px; padding: 0 12px; }
  .usage, #gv { display: none; }
}

/* ============================ chuyen man ============================ */

.views { margin-left: 8px; }
.ov { display: none; grid-template-rows: auto 1fr; min-height: 0; }
body.view-ov .shell { display: none; }
body.view-ov .ov { display: grid; }
.d0 { display: none; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 0; }
body.view-d0 .shell, body.view-d0 .ov, body.view-d0 .an { display: none; }
body.view-d0 .d0 { display: grid; }
.an { display: none; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); min-height: 0; }
body.view-an .shell, body.view-an .ov { display: none; }
body.view-an .an { display: grid; }

/* ============================== phan tich ============================== */

.an-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.an-body > * { flex: none; }
.an .pad-h { padding: 12px 16px 0; }
.an .tscroll { overflow-x: auto; max-width: 100%; }
.an .panel { min-width: 0; }
.an-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .an-two { grid-template-columns: minmax(0, 1fr); } }
.an-chart { min-height: 220px; }
.an-lg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--slate); margin-top: 6px; }
.an-lg span { display: inline-flex; align-items: center; gap: 5px; }
.an-dates { display: inline-flex; align-items: center; gap: 6px; }
.an-dates[hidden] { display: none; }
.an-t td.an-na { color: var(--mute); }
.an-t td.an-part, .an-foot .an-part { font-style: italic; color: var(--slate); }
.an-t td.good { color: var(--live); font-weight: 550; }
.an-t tr.sumrow td { font-weight: 600; background: var(--wash); }
/* bang cohort / Bang D0 khong cuon doc trong khung: dong tong khong dinh (quy tac .sumrow chung + td:first-child relative day o ten xuong 38px) */
.d0t tr.sumrow td { position: static; top: auto; }
/* bang cohort: khung cuon rieng (thanh cuon ngang luon thay), dinh tieu de + dong tong + cot ten, keo chuot de cuon */
.an .an-ts { max-height: min(72vh, 760px); overflow: auto; cursor: grab; border-top: 1px solid var(--rule); }
.an .an-ts.dragging { cursor: grabbing; user-select: none; }
.an-t thead th { position: sticky; top: 0; z-index: 3; background: var(--card); }
.an-t tr.sumrow td { position: sticky; top: var(--an-h, 37px); z-index: 2; }
.an-t td:first-child, .an-t th:first-child { position: sticky; left: 0; z-index: 2; background: var(--card); box-shadow: 1px 0 0 var(--rule); }
.an-t thead th:first-child { z-index: 4; }
.an-t tr.sumrow td:first-child { z-index: 3; background: var(--wash); }
.an-t td.d0-name { min-width: 200px; max-width: 300px; }
.am-part { font-style: italic; color: var(--slate); }
.an-foot { font-size: 12px; color: var(--mute); margin: 0; line-height: 1.55; }

/* ============================== bang D0 ============================== */

.d0-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.d0-body > * { flex: none; }
.d0-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .d0-two { grid-template-columns: minmax(0, 1fr); } }
.d0-note { padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--wash); color: var(--slate); font-size: 12.5px; }
.d0 .tscroll { overflow-x: auto; }
.d0 .pad-h { padding: 12px 16px 0; }
.d0t td, .d0t th { white-space: nowrap; }
.d0t thead th { background: var(--card); }
.d0t tr.d0-pick { cursor: pointer; }
.d0t td.d0-name { white-space: normal; min-width: 240px; max-width: 460px; }
.d0t td.d0-name b { display: block; font-weight: 550; overflow-wrap: anywhere; }
.d0t td.d0-name small { display: block; color: var(--mute); font-size: 11px; overflow-wrap: anywhere; }
.d0t td.d0-app { color: var(--slate); font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.d0t td.d0-swc { width: 44px; }
.d0t td.d0-empty { text-align: center; color: var(--mute); padding: 22px 12px; }
.d0-st { font-size: 11.5px; color: var(--mute); }
.d0-bud { background: none; border: 0; border-bottom: 1px dashed var(--rule-3); padding: 0 0 1px; font: inherit; color: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.d0-bud:hover:not(:disabled) { border-bottom-color: var(--ink); }
.d0-bud:disabled { border-bottom-color: transparent; cursor: default; }
.d0-bud small { color: var(--mute); font-size: 11px; }
.d0-bin { width: 110px; text-align: right; font: inherit; padding: 2px 6px; }
.d0-more { padding: 10px 16px 14px; text-align: center; }

/* ============================== tong quan ============================== */

.ov-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.ov-empty {
  max-width: 560px; margin: 40px auto; text-align: center;
  color: var(--slate); font-size: 13.5px; line-height: 1.65;
}
.ov-empty b { display: block; margin-bottom: 6px; font-size: 15px; color: var(--ink); }
.ov-empty i { font-style: normal; font-weight: 550; color: var(--ink); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
.kpis:empty { display: none; }
.kpi {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.kpi small {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--mute);
}
.kpi b {
  display: block; margin-top: 4px;
  font-size: 20px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi em { display: block; margin-top: 2px; font-style: normal; font-size: 11.5px; color: var(--mute); }
.kpi.good b { color: var(--live); }
.kpi.bad b { color: var(--halt); }

.panel {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--shadow-sm); padding: 14px 16px;
}
.panel.flush { padding: 0; overflow: hidden; }
.panel[hidden] { display: none; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head b { font-size: 13.5px; font-weight: 600; }
.panel-head .sub { font-size: 12px; color: var(--mute); }
.panel-head .chips { margin-left: auto; }

/* bieu do cot 24 gio */
.chart {
  display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px;
  height: 150px; align-items: end;
  padding-bottom: 20px; position: relative;
  border-bottom: 1px solid var(--rule-2);
}
.chart .col {
  height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px;
  position: relative;
}
.chart .col i { display: block; flex: 1; max-width: 22px; border-radius: 3px 3px 0 0; min-height: 0; }
.chart .col i.bs { background: var(--ink); opacity: .78; }
.chart .col i.br { background: var(--live); }
.chart .col span {
  position: absolute; bottom: -19px; left: 0; right: 0; text-align: center;
  font: 10.5px var(--mono); color: var(--mute);
}
.chart .col.fut i { opacity: .15; }
.chart .col.cur span { color: var(--ink); font-weight: 600; }
.chart .col.cut::after {
  content: ""; position: absolute; inset: 0 -2px;
  background: repeating-linear-gradient(135deg, transparent 0 5px, var(--shade) 5px 7px);
  pointer-events: none;
}
.chart .col:hover i { opacity: 1; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11.5px; color: var(--mute); flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend .ls { background: var(--ink); opacity: .78; }
.legend .lr { background: var(--live); }
.legend .lc {
  background: repeating-linear-gradient(135deg, var(--card) 0 3px, var(--rule-3) 3px 5px);
  border: 1px solid var(--rule);
}

/* bang 24 gio: hang = chi so, cot = gio */
.hgrid { overflow-x: auto; margin-top: 12px; }
.hgrid table { border-collapse: collapse; width: 100%; min-width: 1180px; }
.hgrid th, .hgrid td {
  padding: 5px 6px; text-align: right; white-space: nowrap;
  font: 11.5px/1.3 var(--mono); font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--rule-2);
}
.hgrid thead th {
  position: static; background: none; text-transform: none; letter-spacing: 0;
  color: var(--mute); font-weight: 500; padding-top: 0;
}
.hgrid th.lab, .hgrid td.lab {
  text-align: left; font-family: var(--sans); font-size: 11.5px; font-weight: 550;
  color: var(--slate); position: sticky; left: 0; background: var(--card); z-index: 1;
}
.hgrid td.tot, .hgrid th.tot { font-weight: 650; color: var(--ink); border-left: 1px solid var(--rule); }
.hgrid .fut { color: var(--mute); opacity: .7; }
.hgrid .cur { background: var(--wash); }
.hgrid .cut { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--shade) 5px 7px); }
.hgrid td.good { color: var(--live); }
.hgrid td.bad { color: var(--halt); }
.hgrid tr.row-r td:not(.lab) { color: var(--live); }

/* bang campaign tong quan */
.ovt thead th { background: var(--card); }
.ovt td.acc-cell { font-size: 12.5px; color: var(--slate); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovt td.acc-cell button {
  background: none; border: 0; padding: 0; color: inherit; text-align: left;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ovt td.acc-cell button:hover { color: var(--ink); text-decoration: underline; }
.ovt td.acc-cell small { display: block; color: var(--mute); font-size: 11px; }
.ovt .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--rule); margin-right: 6px; }
.ovt .dot.on { background: var(--live); box-shadow: 0 0 0 3px var(--live-bg); }
.w-x { width: 34px; }

/* nut mo bang theo gio tren tung campaign */
.hbtn {
  border: 1px solid var(--rule); background: var(--card); border-radius: 5px;
  width: 24px; height: 22px; padding: 0; line-height: 1;
  font-size: 11px; color: var(--slate);
  transition: background .1s, color .1s;
}
.hbtn:hover { background: var(--wash); color: var(--ink); }
.hbtn.open { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.cname .hbtn { margin-left: 8px; vertical-align: 1px; }
tr.hrow > td { background: var(--paper); padding: 6px 14px 14px; }
tr.hrow .hgrid { margin-top: 4px; }
tr.hrow .hnote { font-size: 11.5px; color: var(--mute); margin-bottom: 2px; }
tr.hrow:hover { background: var(--paper); }
.ov.noaf .adj { display: none; }
.ovt td.ov-none { text-align: center; color: var(--mute); padding: 28px; }
tr.hrow .hnote.err { color: var(--halt); }
.hlink {
  margin-left: 10px; background: none; border: 0; padding: 0;
  font: 500 11.5px var(--sans); color: var(--slate);
  border-bottom: 1px dotted var(--mute);
}
.hlink:hover { color: var(--ink); border-bottom-color: var(--ink); }
.hlink.open { color: var(--ink); border-bottom-style: solid; }

/* chuyen tu style inline (CSP style-src self chan thuoc tinh style) */
.ix1 { width:34px !important; }
.ix2 { width:62px !important; }
.ix3 { width:110px !important; }
.ix4 { width:118px !important; }
.ix5 { width:96px !important; }
.ix6 { width:92px !important; }
.ix7 { width:78px !important; }
.ix8 { width:104px !important; }
.ix9 { margin-bottom:8px !important; }
.ix10 { display:flex !important; gap:6px !important; align-items:center !important; font-size:12px !important; color:var(--mute) !important; margin:0 !important; }
.ix11 { width:100% !important; border-collapse:collapse !important; }
.ix12 { margin:0 !important; }
.ix13 { grid-template-columns:1fr auto auto !important; }
.ix14 { align-self:center !important; color:var(--mute) !important; font:11px var(--mono) !important; }
.ix15 { font-style:normal !important; }
.ix16 { color:var(--mute) !important; font-size:13px !important; }
.ix17 { color:var(--slate) !important; font-size:13px !important; line-height:1.6 !important; }
.ix18 { color:var(--halt) !important; font-size:12px !important; }
.ix19 { color:var(--mute) !important; font-size:12px !important; }
.ix20 { color:var(--mute) !important; font:11px var(--mono) !important; }
.ix21 { color:var(--live) !important; }
.ix22 { text-align:right !important; white-space:nowrap !important; }
.ix23 { font:11px var(--mono) !important; color:var(--mute) !important; }

/* ===================== tong quan v2: bieu do duong + kho trong ngay ===================== */

.ov-body > * { flex-shrink: 0; }          /* khong cho panel co lai -> moi cuon duoc */
.pad-h { padding: 12px 16px 4px; margin-bottom: 0; }

.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi em { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.kpi em span { color: var(--mute); }
.kpi .dl { font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .dl.up { color: var(--live); }
.kpi .dl.down { color: var(--halt); }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.charts[hidden] { display: none; }
@media (max-width: 1100px) { .charts { grid-template-columns: 1fr; } }
.charts .panel-head { margin-bottom: 6px; }

/* bieu do duong */
.lc { position: relative; width: 100%; min-height: 60px; }
.lc svg { display: block; overflow: visible; }
.lc .g { stroke: var(--rule-2); stroke-width: 1; }
.lc .g0 { stroke: var(--rule); stroke-width: 1; }
.lc .yl { font: 10.5px var(--mono); fill: var(--mute); text-anchor: end; }
.lc .xl { font: 10.5px var(--mono); fill: var(--mute); text-anchor: middle; }
.lc .yl.r { text-anchor: end; }
.lc .endl { font: 600 11px var(--mono); fill: var(--ink); }
.lc .now { stroke: var(--mute); stroke-width: 1; stroke-dasharray: 2 3; }
.lc .ref { stroke: var(--slate); stroke-width: 1; stroke-dasharray: 5 3; opacity: .7; }
.lc .refl { font: 10.5px var(--sans); fill: var(--slate); }
.lc .est { fill: var(--shade); }
.lc .xh { stroke: var(--ink); stroke-width: 1; opacity: .35; }
.lc .hit { cursor: crosshair; }
.lc .tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 170px; padding: 8px 10px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: var(--shadow); font-size: 12px;
}
.lc .tip b { display: block; margin-bottom: 5px; font-size: 11.5px; font-weight: 600; color: var(--slate); }
.lc .tip div { display: flex; align-items: center; gap: 7px; line-height: 1.7; }
.lc .tip strong { font: 600 12px var(--mono); color: var(--ink); min-width: 56px; }
.lc .tip span { color: var(--mute); }
.lc .tip .k, .lg .ln {
  display: inline-block; width: 14px; height: 0;
  border-top: 2px solid var(--ink);
}
.lc .tip .k.dash, .lg .ln.dash { border-top-style: dashed; opacity: .6; }
.lg .ln[data-c="spend"] { border-color: var(--c-spend); }
.lg .ln[data-c="rev"] { border-color: var(--c-rev); }
.lg .ln[data-c="ink"] { border-color: var(--c-ink); }

.lg { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--slate); align-items: center; }
.lg span { display: inline-flex; align-items: center; gap: 6px; }
.lg .note { color: var(--mute); }
.lg .sw-est { display: inline-block; width: 12px; height: 10px; background: var(--shade); border-radius: 2px; }

/* breakout 1 campaign */
.bk { padding: 4px 0 2px; }
.bk-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 10px; }
.st small {
  display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--mute);
}
.st b { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.st em { display: block; font-style: normal; font-size: 11px; color: var(--mute); }
.st.good b { color: var(--live); }
.st.bad b { color: var(--halt); }
.bk-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.bk-charts.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .bk-charts, .bk-charts.three { grid-template-columns: 1fr; } }
.bk-noaf { align-self: center; color: var(--mute); font-size: 12.5px; }
.bk-foot { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.bk-foot .lg { margin-top: 0; flex: 1; }

.htbl { margin-top: 10px; max-height: 340px; overflow: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); }
.htbl table { width: 100%; border-collapse: collapse; }
.htbl th {
  position: sticky; top: 0; background: var(--card); z-index: 1;
  padding: 7px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--mute); text-align: left; border-bottom: 1px solid var(--rule);
}
.htbl th.num { text-align: right; }
.htbl td { padding: 5px 10px; font: 12px var(--mono); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--rule-2); }
.htbl td small { font: 10.5px var(--sans); color: var(--mute); }
.htbl tr.run td { color: var(--slate); background: var(--paper); }
.htbl td.good { color: var(--live); }
.htbl td.bad { color: var(--halt); }

/* bang tong quan */
.ovt td.bad, .ovt td.good { font-weight: 550; }
.ovt td.good { color: var(--live); }
.ovt td.bad { color: var(--halt); }
.ovt td.acc-cell b { display: block; font-weight: 500; color: var(--ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ovAcctRows tr { cursor: pointer; }
#ovAcctRows tr.picked { background: var(--wash); box-shadow: inset 2px 0 0 var(--ink); }
.ovt tr.opened > td { background: var(--paper); }
.w-spark { width: 110px; }
.spark { display: block; }
.spark .ref { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 2; }
.spark-none { color: var(--mute); }
.hbtn { font-size: 14px; font-weight: 600; }
.cmeta .dot { margin-right: 4px; width: 6px; height: 6px; }
.kpi .dl.flat { color: var(--slate); }
.bk { position: sticky; left: 14px; }
.cname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.cmp:empty { display: none; }
.cmp { margin-top: 14px; }
.cmp-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; }
.cmp table { width: 100%; border-collapse: collapse; }
.cmp th { padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--mute); text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.cmp th.num, .cmp td.num { text-align: right; }
.cmp td { padding: 7px 10px; font: 12.5px var(--mono); border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
.cmp td small { display: block; font: 10.5px var(--sans); color: var(--mute); }
.cmp .cur { background: var(--wash); }
.cmp tr.tot td { font-weight: 650; border-top: 1px solid var(--rule); }
.cmp td.bad, .hint.err { color: var(--halt); }
.cmp-err { font-size: 12px; color: var(--halt); }
.cmp th small { display:block; font-weight:500; color: var(--live); text-transform:none; } .hint .err { color: var(--halt); }
#afAppsList { max-height: 260px; }

/* Hang tong: ngay duoi tieu de, dinh cung tieu de khi cuon */
.sumrow td { font-weight: 600; background: var(--wash); border-bottom: 2px solid var(--rule-2);
  position: sticky; top: var(--hdr, 38px); z-index: 2; padding: 9px 14px; vertical-align: middle; }
.sumrow td small { display: block; font-weight: 400; color: var(--mute); font-size: 11px; }
.sumrow:empty { display: none; }
/* Bat/tat + budget ngay trong Tong quan */
.ovsw { display: inline-flex; align-items: center; gap: 6px; }
.ovsw .sw { transform: scale(.85); }
.budin.ovb { width: 90px; }
.cur { font-size: 11px; opacity: .65; margin-left: 2px; }

/* Cot co dinh khi cuon ngang */
.tscroll { overflow-x: auto; }
td.stk, th.stk { position: sticky !important; z-index: 1; }
thead th.stk, .sumrow td.stk { z-index: 4; }
#rows td.stk { background: var(--paper); }
#rows tr:hover td.stk { background: var(--card); }
#rows tr.picked td.stk { background: var(--wash); }
.ovt td.stk { background: var(--card); }
.ovt thead th.stk { background: var(--card); }
.sumrow td.stk { background: var(--wash); }
.stk-edge { box-shadow: inset -1px 0 0 var(--rule-2), 8px 0 10px -8px rgba(20, 24, 31, .18); }

/* Thanh trang thai: Meta / AppsFlyer / Khop so */
.stbar { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 12px; color: var(--slate); background: var(--wash); border: 1px solid var(--rule-2); white-space: nowrap; cursor: default; }
.pill b { font-weight: 600; color: var(--ink); }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); flex: none; }
.pill.ok i { background: var(--live); box-shadow: 0 0 0 3px var(--live-bg); }
.pill.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.pill.warn i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-ring); }
.pill.bad { background: var(--halt-bg); border-color: var(--halt); color: var(--halt); }
.pill.bad b { color: var(--halt); }
.pill.bad i { background: var(--halt); animation: pillPulse 1.6s ease-in-out infinite; }
.pill.info { background: var(--card); }
.pill.info i { background: var(--ink); }
@keyframes pillPulse { 50% { opacity: .35; } }
/* bang Ads Manager dang tai: dong chu nhap nhay de khong tuong tai khoan trong */
.am-loading { animation: pillPulse 1.2s ease-in-out infinite; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .pill.bad i { animation: none; } }

/* Bang theo app */
#ovAppRows tr { cursor: pointer; }
#ovAppRows tr.unknown td { color: var(--mute); }
#ovAppRows tr.unknown td.acc-cell b { color: var(--halt); }
.ovt td small.sub2 { display: block; color: var(--mute); font-size: 11px; font-weight: 400; }

/* ============================ mat do dong ============================ */
.dens { margin-right: 2px; }
.dens button { padding: 4px 10px; font-size: 12px; }
.dense thead th { padding: 8px 12px; }
.dense tbody td { padding: 5px 12px; }
.dense .cname { font-size: 13px; max-width: 300px; }
.dense #rows td .cname, .dense .ovt td .cname { display: inline-block; vertical-align: middle; }
.dense #rows td .cmeta, .dense .ovt td .cmeta { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 8px; vertical-align: middle; }
.dense .cid { display: none; }
.dense td:has(> .cname) { white-space: nowrap; }
.dense .issue { margin-top: 0; font-size: 11.5px; }
.dense td.num { font-size: 12.5px; }
.dense .sw { width: 30px; height: 17px; }
.dense .sw::after { width: 13px; height: 13px; }
.dense .sw.on::after { transform: translateX(13px); }
.dense .ovt td.acc-cell small, .dense .ovt td small.sub2 { display: none; }
.dense .ovt td.acc-cell b { font-size: 12.5px; }
.dense .kpi { padding: 9px 12px; }
.dense .kpi b { font-size: 18px; }
.dense .ov-body { gap: 12px; }
.dense .hbtn { width: 20px; height: 19px; }
.dense tr.hrow > td { padding: 6px 12px 12px; }

/* ============================ an/hien cot ============================ */
.cols-btn.on { border-color: var(--ink); color: var(--ink); }
.hc-obj .c-obj, .hc-budget .c-budget, .hc-spend .c-spend, .hc-adrev .c-adrev, .hc-adrevd0 .c-adrevd0,
.hc-profit .c-profit, .hc-roas .c-roas, .hc-impr .c-impr, .hc-clicks .c-clicks, .hc-updated .c-updated,
.hc-acct .c-acct, .hc-act .c-act, .hc-rev .c-rev, .hc-roasd0 .c-roasd0, .hc-pnl .c-pnl, .hc-spark .c-spark, .hc-inst .c-inst, .hc-cpi .c-cpi { display: none; }
.colpop {
  position: absolute; z-index: 50; width: 220px;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 8px 6px 6px;
}
.colpop .cp-head { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mute); padding: 2px 8px 6px; }
.colpop label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.colpop label:hover { background: var(--wash); }
.colpop .cp-foot { display: flex; gap: 6px; padding: 8px 6px 2px; border-top: 1px solid var(--rule-2); margin-top: 4px; }

/* ============================ can xu ly ============================ */
.act-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
@media (max-width: 1100px) { .act-panel { grid-template-columns: 1fr; } }
.act-col { padding: 12px 14px 8px; min-width: 0; }
.act-col + .act-col { border-left: 1px solid var(--rule-2); }
@media (max-width: 1100px) { .act-col + .act-col { border-left: 0; border-top: 1px solid var(--rule-2); } }
.act-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.act-head b { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.act-head b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.act-col.burn .act-head b::before { background: var(--halt); box-shadow: 0 0 0 3px var(--halt-bg); }
.act-col.scale .act-head b::before { background: var(--live); box-shadow: 0 0 0 3px var(--live-bg); }
.act-head .sub { font-size: 12px; color: var(--mute); }
.act-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px 68px 84px auto; gap: 10px; align-items: center;
  padding: 7px 6px; border-radius: 6px; cursor: pointer; transition: background .1s;
}
.act-row:hover { background: var(--wash); }
.act-row + .act-row { border-top: 1px solid var(--rule-2); }
.act-main { min-width: 0; }
.act-main b { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-main small { display: block; font-size: 11px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-n { text-align: right; line-height: 1.25; }
.act-n span { display: block; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); }
.act-n b { font-size: 13px; font-weight: 550; font-variant-numeric: tabular-nums; }
.act-n b.good { color: var(--live); }
.act-n b.bad { color: var(--halt); }
.act-do { min-width: 54px; text-align: right; }
.act-do .mini { padding: 3px 9px; }
.act-none { padding: 14px 6px; color: var(--mute); font-size: 12.5px; }
.dense .act-row { padding: 4px 6px; }
.dense .act-main small { display: none; }

/* dong vua nhay toi tu hop Can xu ly */
@keyframes rowFlash { 0% { background: var(--warn-bg); } 100% { background: transparent; } }
tr.flash > td { animation: rowFlash 1.8s ease-out; }
@media (max-width: 700px) {
  .act-row { grid-template-columns: 1fr 1fr 1fr auto; gap: 6px 10px; }
  .act-main { grid-column: 1 / -1; }
}

/* CMS: quyen theo app */
.ix23 { margin: 6px 0 0; font-size: 12px; }
.picker input[type=checkbox] { width: 15px; height: 15px; flex: none; margin: 0; }
.pick-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pick-head label { margin: 0; }
.pick-head .spacer { flex: 1; }
.picker.apps { max-height: 320px; padding: 4px; }
.picker.apps label { display: grid; grid-template-columns: 18px minmax(0, 1.2fr) minmax(0, 1.6fr) 64px; gap: 10px; align-items: center; padding: 6px 8px; }
.picker.apps label b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker.apps label code { font: 12px var(--mono); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker.apps label .pl { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--slate); background: var(--wash); border-radius: 4px; padding: 2px 6px; text-align: center; }
.picker.apps label.on { background: var(--live-bg); }
.picker.apps label.on:hover { background: var(--live-bg); filter: brightness(.97); }
.picker.apps .head { padding: 8px 8px 6px; }

/* Cot D0 rev / D0 ROAS luon hien (D0 lay tu Cohort API) */

.bk-ct { font-size: 11px; font-weight: 600; color: var(--slate); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }

/* Hom nay: bo ROAS luy ke (chi xem o Hom qua), bieu do luy ke trai rong ca hang */
.ov.today #ovCharts .panel.cum { grid-column: 1 / -1; }

/* chon giao dien sang/toi */
.chips.theme button { min-width: 0; }

/* TikTok: chon Business Center */
.tt-extra { width: 100%; margin: 10px 0 8px; }
.tt-direct { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate); margin-bottom: 10px; }
.tt-direct input { width: auto; margin: 0; }

/* Chon network o danh sach ad account (tab Campaign). */
.net-pick { padding-top: 0; }
.net-pick .chips { width: 100%; flex-wrap: wrap; row-gap: 2px; }
.net-pick .chips button { flex: 1 1 auto; padding: 5px 6px; white-space: nowrap; }
.net-pick .chips button small { color: var(--slate); font-weight: 400; margin-left: 3px; }

/* Google Ads: danh sach ket noi (CMS). */
#tabGads .gh { font-size: 13px; }
#tabGads .form .row .spacer { flex: 1; }
#tabGads .gconn { margin: 14px 0; padding: 14px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--paper); }
#gRows .gerr { color: var(--halt); font-size: 12px; margin-top: 3px; max-width: 520px; white-space: normal; }
#gRows .gok { color: var(--go, #0a7d55); }
#gRows .cmeta { white-space: nowrap; }
#gForm[data-kind="hub"] .g-oauth, #gForm[data-kind="oauth"] .g-hub { display: none; }
#gKind { display: inline-flex; }
#gRows .gkind { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--wash); color: var(--slate); margin-left: 6px; vertical-align: 1px; }

/* Sandbox (test.magixcampaign.app) */
.sandbox { margin-left: 10px; padding: 2px 8px; border-radius: 5px; font: 600 11px var(--mono); letter-spacing: .06em;
  color: #fff; background: #d97706; }
#runOnce { margin-left: 8px; white-space: nowrap; }
body.is-sandbox header { box-shadow: inset 0 -2px 0 #d97706; }

/* AppsFlyer dashboard (web) cookie */
.afweb { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--rule); }
.afweb textarea { width: 100%; font: 12px var(--mono); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px 10px; background: var(--card); color: var(--ink); resize: vertical; }

/* Keo do rong cot (bang .rz): mep phai tieu de cot */
table.rz > thead > tr > th::after { content: ''; position: absolute; top: 4px; bottom: 4px; right: 0; width: 3px; border-right: 1px solid transparent; }
table.rz > thead > tr > th:hover::after { border-right-color: var(--line, #d0d5dd); }
table.rz > thead > tr > th.rz-hot { cursor: col-resize; }
table.rz > thead > tr > th.rz-hot::after { border-right: 2px solid var(--live, #16a34a); }
body.rz-drag, body.rz-drag * { cursor: col-resize !important; user-select: none !important; }

/* ============================ len camp tiktok ============================ */

.tt { display: none; grid-template-rows: auto 1fr auto; min-height: 0; }
body.view-tt .shell { display: none; }
body.view-tt .tt { display: grid; }
.tt .toolbar #ttAcct, .tt .toolbar .ss { max-width: 360px; color: var(--ink); }
.tt .toolbar .ss, .mt .toolbar .ss { width: 360px; }
.tt-body { gap: 14px; }
.tt-note { margin: 0; font-size: 12.5px; color: var(--slate); }
.tt-note b { color: var(--ink); font-weight: 600; }
.tt-pane { display: flex; flex-direction: column; gap: 14px; }
.tt-pane[hidden] { display: none; }
.tt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.tt-grid .tt-wide { grid-column: 1 / -1; }
@media (max-width: 1100px) { .tt-grid { grid-template-columns: minmax(0, 1fr); } }

.tt-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin-bottom: 10px; flex: 1 1 160px; }
.tt-f.sm { flex: 0 1 120px; }
.tt-f > label, .tt-vhead > label { font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--mute); }
.tt-f input, .tt-f select, .tt-f textarea, .tt-pair input, .tt-vhead input, .tt-tplname, .tt-rename {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 8px 10px; font-size: 13px; color: var(--ink); outline: none; width: 100%;
}
.tt-f textarea { resize: vertical; font-family: var(--sans); line-height: 1.45; }
.tt-f input:focus, .tt-f select:focus, .tt-f textarea:focus, .tt-pair input:focus, .tt-vhead input:focus, .tt-tplname:focus, .tt-rename:focus {
  border-color: var(--ink); box-shadow: 0 0 0 3px var(--shade);
}
.tt-f .chips { align-self: flex-start; }
.tt-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.tt-chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink); margin-bottom: 10px; white-space: nowrap; }
.tt-hint { margin: 0; font-size: 12px; color: var(--warn); min-height: 0; }
.tt-hint:empty { display: none; }
.tt-pair { display: flex; gap: 6px; }
.tt-pair select { flex: 0 0 74px; }

.tt-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.tt-flag { font-size: 11.5px; padding: 3px 8px; border-radius: 99px; background: var(--wash); color: var(--slate); }
.tt-flag.mono, .mono { font-family: var(--mono); }
.tt-flag.ok { background: var(--live-bg); color: var(--live); }
.tt-flag.bad { background: var(--halt-bg); color: var(--halt); }
.tt-flag.warn { background: var(--warn-bg); color: var(--warn); }

.tt-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tt-tag {
  border: 1px solid var(--rule); background: var(--wash); border-radius: 99px;
  padding: 3px 6px 3px 10px; font-size: 12px; color: var(--ink);
}
.tt-tag i { font-style: normal; color: var(--mute); margin-left: 4px; }
.tt-tag:hover i { color: var(--halt); }
.tt-empty { font-size: 12.5px; color: var(--mute); padding: 4px 0; }
.tt-f { position: relative; }
.tt-drop {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; padding: 4px;
}
.tt-drop.rel { position: relative; top: 0; margin: -6px 0 10px; }
.tt-drop button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 6px 8px; border-radius: 5px; font-size: 13px;
}
.tt-drop button:hover { background: var(--wash); }
.tt-drop button b { font-family: var(--mono); font-weight: 600; margin-right: 6px; }
.tt-drop small { color: var(--mute); }

.tt-vhead { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; flex-wrap: wrap; }
.tt-vhead input { width: 240px; }
.spacer { flex: 1; }
.tt-vids { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; max-height: 430px; overflow-y: auto; padding: 2px; }
.tt-vid {
  position: relative; display: flex; flex-direction: column; text-align: left;
  border: 1px solid var(--rule); background: var(--card); border-radius: var(--r-sm);
  padding: 0; overflow: hidden; transition: border-color .12s, box-shadow .12s;
}
.tt-vid img, .tt-noimg { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: var(--wash); display: block; }
.tt-noimg { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--mute); }
.tt-vmeta { padding: 6px 8px 7px; display: flex; flex-direction: column; min-width: 0; }
.tt-vmeta b { font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-vmeta small { font-size: 11px; color: var(--mute); }
.tt-tick {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(20,22,26,.45); border: 2px solid #fff; color: #fff;
  font-style: normal; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.tt-vid:hover { border-color: var(--rule-3); }
.tt-vid.on { border-color: var(--live); box-shadow: 0 0 0 2px var(--live); }
.tt-vid.on .tt-tick { background: var(--live); border-color: var(--live); }
.tt-more { text-align: center; margin-top: 10px; }

.tt-q { flex: 1 1 220px; max-width: 320px; margin-left: auto; }
.tt-src { max-height: 340px; overflow-y: auto; border: 1px solid var(--rule); border-radius: var(--r-sm); }
.tt-camp {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) 110px 48px; gap: 10px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--rule); cursor: pointer; font-size: 13px;
}
.tt-camp:last-child { border-bottom: 0; }
.tt-camp:hover { background: var(--wash); }
.tt-camp.off .tt-cname b { color: var(--slate); }
.tt-cname { display: flex; flex-direction: column; min-width: 0; }
.tt-cname b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-cname small, .tt-cbud small { font-size: 11.5px; color: var(--mute); }
.tt-cbud { text-align: right; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; }
.tt-cst { font-size: 11.5px; color: var(--mute); text-align: right; }
.tt-cst.on { color: var(--live); font-weight: 600; }
.tt-sum:empty { display: none; }
.tt-sum { margin-top: 12px; }
.tt-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 13px; }
.tt-dl dt { color: var(--mute); }
.tt-dl dd { margin: 0; }
.tt-tplpick { padding: 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.tt-tplhead { display: flex; gap: 12px; align-items: baseline; padding: 14px 16px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.tt-tplhead .sub { font-size: 12px; color: var(--mute); }
.tt-tpls .tt-empty { padding: 18px 16px; }
.tt-tplrow { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.tt-tplrow:last-child { border-bottom: 0; }
.tt-tplmain { flex: 1 1 320px; display: flex; flex-direction: column; min-width: 0; }
.tt-tplmain b { font-weight: 600; }
.tt-tplmain small { font-size: 12px; color: var(--slate); }
.tt-tplmain small.mute { color: var(--mute); }
.tt-rename { width: 220px; }

.tt-tgts { display: flex; flex-direction: column; gap: 10px; }
.tt-tgt { border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 10px 12px; border-left-width: 3px; }
.tt-tgt.ok { border-left-color: var(--live); }
.tt-tgt.warn { border-left-color: var(--warn); }
.tt-tgt.err { border-left-color: var(--halt); }
.tt-tgthead { display: flex; gap: 10px; align-items: baseline; }
.tt-tgthead small { color: var(--mute); font-family: var(--mono); font-size: 11.5px; }
.tt-pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--wash); color: var(--slate); }
.tt-pill.ok { background: var(--live-bg); color: var(--live); }
.tt-pill.warn { background: var(--warn-bg); color: var(--warn); }
.tt-pill.err { background: var(--halt-bg); color: var(--halt); }
.tt-tgtpick { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--slate); }
.tt-tgtpick label { display: inline-flex; gap: 6px; align-items: center; }
.tt-tgtpick select { max-width: 280px; color: var(--ink); }
.tt-checks { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.tt-check { font-size: 12.5px; padding-left: 18px; position: relative; color: var(--ink); }
.tt-check::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.tt-check.ok::before { content: "✓"; color: var(--live); }
.tt-check.warn::before { content: "!"; color: var(--warn); left: 4px; }
.tt-check.err { color: var(--halt); }
.tt-check.err::before { content: "×"; color: var(--halt); }
.tt-results { display: flex; flex-direction: column; gap: 4px; }
.tt-preview { margin-top: 6px; }
.tt-preview:empty { display: none; }
.tt-preview .ovt { width: 100%; font-size: 12.5px; }

.tt-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--card); border-top: 1px solid var(--rule);
}
.tt-bar[hidden] { display: none; }
.tt-barmsg { font-size: 12.5px; color: var(--slate); min-width: 0; }
.tt-barmsg.ok { color: var(--live); }
.tt-barmsg.bad { color: var(--halt); }
.tt-bar .tt-chk { margin: 0; }
.tt-bar .act.on.armed { background: var(--halt); }
.tt-tplname { width: 200px; }
@media (max-width: 720px) {
  .tt-camp { grid-template-columns: 22px minmax(0, 1fr) 70px; }
  .tt-cst { display: none; }
  .tt-bar { padding: 10px 12px; }
}
.tt { grid-template-columns: minmax(0, 1fr); }
.tt > *, .tt-body > *, .tt-grid > * { min-width: 0; }
.tt-f:has(> .chips) { flex: 0 0 auto; }
.tt .toolbar .chips { flex-wrap: wrap; }
@media (max-width: 720px) {
  .tt .toolbar { padding: 10px 12px; }
  .tt .toolbar #ttAcct, .tt .toolbar .ss { max-width: 100%; width: auto; flex: 1 1 100%; }
  .tt-body { padding: 12px; }
  .tt-vhead input { width: 100%; }
}
body { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 720px) { header { overflow-x: auto; } }
/* lai / lo theo khung gio */
.charts .panel.span2 { grid-column: 1 / -1; }
.bk-pnl { margin: 4px 0 16px; }
.bk-pnl .bk-ct .sub { font-weight: 400; color: var(--mute); margin-left: 8px; text-transform: none; letter-spacing: 0; }
.lg .sw-pos, .lg .sw-neg { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg .sw-pos { background: var(--c-rev); }
.lg .sw-neg { background: var(--c-bad); }

/* ---------- TikTok: danh sach campaign / ad group / ad ---------- */
.tt-lbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tt-lbar .tt-q { margin-left: 0; }
.tt-lbar .tt-q.grow { flex: 1 1 260px; max-width: 420px; }
.tt-lbar .tt-q input, .tt-dates input, .tt-lt input:not([type=checkbox]), .tt-agt input, .tt-agt select, .tt-in input, .tt-rvn input, .tt-dupcp input, .tt-lib input {
  width: 100%; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 7px 9px; font-size: 12.5px; color: var(--ink); font-family: inherit;
}
.tt-lbar input:focus, .tt-agt input:focus, .tt-agt select:focus, .tt-in input:focus, .tt-rvn input:focus, .tt-dupcp input:focus { outline: none; border-color: var(--ink); }
input.bad, select.bad { border-color: var(--halt) !important; background: var(--halt-bg) !important; }
.tt-dates { display: inline-flex; align-items: center; gap: 4px; color: var(--mute); }
.tt-dates input { width: 138px; }
.chips.sm button { padding: 4px 9px; font-size: 12px; }
.tt-tabs { display: inline-flex; gap: 0; border-bottom: 1px solid var(--rule); }
.tt-tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 8px 14px; font-size: 13px; font-weight: 500; color: var(--slate);
}
.tt-tabs button:hover { color: var(--ink); }
.tt-tabs button.on { color: var(--ink); border-bottom-color: var(--live); font-weight: 600; }
.tt-tabs i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--live); margin-left: 4px; }
.tt-lsel { font-size: 12.5px; color: var(--slate); display: inline-flex; gap: 6px; align-items: center; }
.tt-colwrap { position: relative; }
.tt-colmenu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 190px;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm); box-shadow: var(--shadow);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.tt-colmenu[hidden] { display: none; }
.tt-colmenu label { display: flex; gap: 8px; align-items: center; padding: 5px 6px; font-size: 13px; border-radius: 4px; cursor: pointer; }
.tt-colmenu label:hover { background: var(--wash); }
.tt-colmenu .mini { margin-top: 4px; align-self: flex-end; }
.tt-tablewrap { overflow-x: auto; }
.tt-lt { font-size: 13px; }
.tt-lt td small, .tt-agt td small { display: block; font-size: 11.5px; color: var(--mute); }
.tt-lt th.sortable { cursor: pointer; user-select: none; }
.tt-lt th.sortable:hover { color: var(--slate); }
.tt-lt td.num { font-variant-numeric: tabular-nums; }
.tt-lt th.tt-ck, .tt-lt td.tt-ck { width: 34px; padding-right: 0; }
.tt-lt th.tt-tg, .tt-lt td.tt-tg { width: 64px; }
.tt-lt td.tt-nm { min-width: 240px; max-width: 420px; }
.tt-lt td.tt-nm b { font-weight: 500; }
.tt-lt tr.on { background: var(--wash); }
.tt-lt td.tt-act { white-space: nowrap; text-align: right; }
.tt-lt td.tt-act .mini + .mini { margin-left: 4px; }
.tt-link {
  background: none; border: 0; padding: 0; text-align: left; font: inherit; font-weight: 500; color: var(--ink);
  cursor: pointer; overflow-wrap: anywhere;
}
.tt-link:hover { text-decoration: underline; }
.tt-clip { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mute { color: var(--mute); }
#ttLFoot { color: var(--mute); }
/* cong tac bat / tat */
.tt-tog { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.tt-tog input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.tt-tog span { position: absolute; inset: 0; border-radius: 10px; background: var(--sw-off); transition: background .16s; pointer-events: none; }
.tt-tog span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform .16s;
}
.tt-tog input:checked + span { background: var(--live); }
.tt-tog input:checked + span::after { transform: translateX(16px); }
.tt-tog input:disabled + span { opacity: .45; }
.tt-tog input:focus-visible + span { box-shadow: 0 0 0 3px var(--live-bg); }

/* ---------- hop thoai ---------- */
body.tt-modal-open { overflow: hidden; }
.tt-modal {
  position: fixed; inset: 0; z-index: 80; background: rgba(15,17,21,.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto;
}
.tt-modal[hidden] { display: none; }
.tt-mbox {
  width: 100%; max-width: 620px; background: var(--card); color: var(--ink); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 88vh;
}
.tt-mbox.wide { max-width: 980px; }
.tt-mhead, .tt-mfoot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.tt-mhead { border-bottom: 1px solid var(--rule); font-size: 15px; }
.tt-mfoot { border-top: 1px solid var(--rule); flex-wrap: wrap; }
.tt-mbody { padding: 16px 18px; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.tt-mbody .tt-row[hidden] { display: none; }
.tt-switch { display: grid; grid-template-columns: 36px 1fr; gap: 2px 12px; align-items: center; cursor: pointer; position: relative; }
.tt-switch input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.tt-switch > span { grid-row: 1 / span 2; width: 36px; height: 20px; border-radius: 10px; background: var(--sw-off); position: relative; transition: background .16s; }
.tt-switch > span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .16s; }
.tt-switch input:checked + span { background: var(--live); }
.tt-switch input:checked + span::after { transform: translateX(16px); }
.tt-switch b { font-size: 13.5px; font-weight: 600; }
.tt-switch small { font-size: 12px; color: var(--mute); grid-column: 2; }
.tt-dupitems { display: flex; flex-direction: column; gap: 10px; }
.tt-dupit { border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.tt-duphd { display: flex; align-items: center; gap: 6px; }
.tt-duphd > div { display: flex; flex-direction: column; min-width: 0; }
.tt-duphd b { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.tt-duphd small { font-size: 11.5px; color: var(--mute); }
.tt-dupn { font-size: 12px; color: var(--mute); white-space: nowrap; }
.tt-dupit.err { border-color: var(--halt); }
.tt-dupit .tt-duperr { font-size: 12px; color: var(--halt); overflow-wrap: anywhere; }
.tt-dupit .tt-dupnote, .tt-rvn small .warn { font-size: 12px; color: var(--warn); overflow-wrap: anywhere; }
/* Thong bao "con ban nhap chua dang" tren danh sach Len camp Meta / TikTok */
.mt-restore { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--warn-line, var(--warn));
  border-radius: var(--r); background: var(--warn-bg); font-size: 13px; }
.mt-restore span { flex: 1; min-width: 200px; }
/* Sua hang loat kieu Ads Manager (mtLiveM) */
.tt-mbox.mt-mbe { width: min(1400px, 96vw); max-width: none; height: min(860px, 92vh); display: flex; flex-direction: column; }
.mt-mbe-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px 220px 1fr; border-top: 1px solid var(--rule); }
.mt-mbe-tree { border-right: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; }
.mt-mbe-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--rule); }
.mt-mbe-tabs button { flex: 1; padding: 6px 4px; border-radius: var(--r); background: transparent; font-size: 12.5px; }
.mt-mbe-tabs button.on { background: var(--wash); font-weight: 600; }
.mt-mbe-tabs button b { font-weight: 600; color: var(--mute); margin-left: 2px; }
.mt-mbe-all { display: flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 6px 10px; border-bottom: 1px solid var(--rule); }
.mt-mbe-items { overflow: auto; flex: 1; }
.mt-mbe-items label { display: flex; gap: 6px; align-items: flex-start; padding: 6px 10px; border-bottom: 1px solid var(--rule); font-size: 12.5px; cursor: pointer; }
.mt-mbe-items label span { overflow-wrap: anywhere; }
.mt-mbe-items label small { display: block; color: var(--mute); font-size: 11px; }
.mt-mbe-items label.chg span::after { content: ' •'; color: var(--warn); font-weight: 700; }
.mt-mbe-nav { border-right: 1px solid var(--rule); overflow: auto; padding: 8px 0; }
.mt-mbe-nav h4 { margin: 10px 14px 4px; font-size: 12.5px; }
.mt-mbe-nav button { display: flex; justify-content: space-between; width: 100%; text-align: left; padding: 6px 14px 6px 20px; background: transparent; border-radius: 0; font-size: 12.5px; }
.mt-mbe-nav button.on { background: var(--wash); font-weight: 600; }
.mt-mbe-nav button i { font-style: normal; font-size: 11px; color: var(--warn); }
.mt-mbe-main { overflow: auto; padding: 12px 16px; }
.mt-mbe-main h3 { margin: 0 0 10px; font-size: 15px; }
.mt-mbe-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.mt-mbe-grid th { text-align: left; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--rule); }
.mt-mbe-grid td { padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.mt-mbe-grid td:first-child { width: 38%; overflow-wrap: anywhere; }
.mt-mbe-grid tr.all td { background: var(--wash); }
.mt-mbe-grid tr.chg td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.mt-mbe-grid .cur { display: block; color: var(--mute); font-size: 11.5px; margin-top: 4px; overflow-wrap: anywhere; }
.mt-mbe-ed { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mt-mbe-ed input[type="text"], .mt-mbe-ed input:not([type]), .mt-mbe-ed textarea, .mt-mbe-ed select { flex: 1; min-width: 140px; }
.mt-mbe-ed select[multiple] { min-height: 110px; }
.mt-mbe-ed label { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; }
.mt-mbe-ed .sm { flex: 0 0 auto; min-width: 70px; width: 80px; }
/* Nav / tab phang (khong khung tung nut nhu nut thuong) */
.mt-mbe-nav button, .mt-mbe-tabs button { border: 0; box-shadow: none; }
.mt-mbe-nav button:hover, .mt-mbe-tabs button:hover { background: var(--wash); }
.mt-mbe-items label:hover { background: var(--wash); }
/* O chon co tim kiem: the (nuoc / ngon ngu) hoac mot gia tri (Page / IG / CTA) — go de loc, Enter / bam de chon */
.mt-pick { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; min-width: 240px; min-height: 34px;
  padding: 3px 6px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); }
.mt-pick:focus-within { border-color: var(--ink); }
.mt-pick.off { opacity: .45; pointer-events: none; }
.mt-pick .mt-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 99px; background: var(--wash); font-size: 12px; white-space: nowrap; }
.mt-pick .mt-tag b { cursor: pointer; padding: 0 4px; color: var(--mute); font-weight: 400; }
.mt-pick .mt-tag b:hover { color: var(--halt); }
.mt-pick-q { flex: 1; min-width: 120px; border: 0 !important; outline: none; background: transparent !important; padding: 4px 2px !important; box-shadow: none !important; }
.mt-pick.single .mt-pick-q { min-width: 200px; }
.mt-pick-pop { position: absolute; left: -1px; right: -1px; top: calc(100% + 2px); z-index: 30; max-height: 260px; overflow: auto; background: var(--card);
  border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow-lg); }
.mt-pick-pop button { display: block; width: 100%; text-align: left; padding: 6px 10px; border: 0; border-radius: 0; background: transparent; font-size: 12.5px; }
.mt-pick-pop button.hi, .mt-pick-pop button:hover { background: var(--wash); }
.mt-pick-pop .tt-empty { padding: 8px 10px; }
.mt-pick-hint { flex-basis: 100%; font-size: 11.5px; color: var(--mute); }
.mt-pick .mt-tag.all { background: transparent; border: 1px dashed var(--rule); color: var(--mute); padding-right: 8px; }
.mt-pick-clear { flex: 0 0 auto; margin-left: auto; font-size: 11.5px; }
.mt-pick-preset { flex: 0 0 auto !important; min-width: 0 !important; width: auto; font-size: 12px; padding: 3px 6px; }
/* Man hep: xep chong ba cot (danh sach muc / truong / o sua), moi cot tu cuon. */
@media (max-width: 960px) {
  .tt-mbox.mt-mbe { height: 94vh; width: 98vw; }
  .mt-mbe-body { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 28%) auto 1fr; }
  .mt-mbe-tree, .mt-mbe-nav { border-right: 0; border-bottom: 1px solid var(--rule); }
  .mt-mbe-nav { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; max-height: 120px; }
  .mt-mbe-nav h4 { display: none; }
  .mt-mbe-nav button { width: auto; padding: 4px 8px; border-radius: var(--r); }
  .mt-mbe-grid td:first-child { width: 34%; }
  .mt-mbe-ed input:not([type]), .mt-mbe-ed textarea, .mt-mbe-ed select { min-width: 100px; }
}
.mt-lparts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 4px 0 6px; font-size: 13px; }
.mt-lparts select { width: auto; padding: 2px 6px; }
.mt-ltable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.mt-ltable td, .mt-ltable th { border-top: 1px solid var(--rule); padding: 5px 6px; vertical-align: top; text-align: left; }
.mt-ltable .old { color: var(--mute); text-decoration: line-through; overflow-wrap: anywhere; }
.mt-ltable .new { overflow-wrap: anywhere; }
.mt-ltable .bad { color: var(--halt); }
.mt-ltable .ok { color: var(--live); }
.mt-ltable small { color: var(--mute); }
.tt-dupsum { border: 1px solid var(--halt); border-radius: var(--r); padding: 8px 12px; margin-bottom: 10px; font-size: 12.5px; max-height: 160px; overflow: auto; }
.tt-dupsum b { color: var(--halt); }
.tt-dupsum li { margin: 2px 0; overflow-wrap: anywhere; }
.tt-dupcp { display: flex; align-items: center; gap: 8px; }
.tt-dupidx { width: 18px; font-size: 11.5px; color: var(--mute); text-align: right; flex: 0 0 auto; }

/* ---------- man duyet ban nhap ---------- */
.tt-rvhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tt-rvhead .tt-chk { margin: 0; }
.tt-rvtitle { display: flex; flex-direction: column; }
.tt-rvtitle b { font-size: 15px; }
.tt-rvtitle small { font-size: 12px; color: var(--mute); }
.tt-rvlist { display: flex; flex-direction: column; gap: 10px; }
.tt-rv { background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--rule); border-radius: var(--r); padding: 10px 12px; }
.tt-rv.ok { border-left-color: var(--live); }
.tt-rv.warn { border-left-color: var(--warn); }
.tt-rv.err { border-left-color: var(--halt); }
.tt-rv.done { opacity: .85; }
.tt-rvh { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tt-fold { background: none; border: 0; padding: 2px 4px; color: var(--slate); font-size: 13px; transition: transform .12s; }
.tt-fold.on { transform: rotate(90deg); }
.tt-rvn { flex: 1 1 300px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tt-rvn input { font-weight: 600; font-size: 13.5px; }
.tt-rvn small { font-size: 11.5px; color: var(--mute); overflow-wrap: anywhere; }
.tt-in { display: inline-flex; flex-direction: column; gap: 3px; font-size: 12px; min-width: 0; }
.tt-in > span { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); }
.tt-in input { width: 110px; }
.tt-in small { font-size: 11px; color: var(--mute); }
.tt-rvb { margin-top: 10px; }
.tt-rvsub { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); margin-bottom: 4px; }
.tt-agt { font-size: 12.5px; }
.tt-agt thead th { position: static; padding: 7px 8px; background: var(--card); }
.tt-agt tbody td { padding: 7px 8px; vertical-align: top; }
.tt-agt td:first-child input { min-width: 190px; }
.tt-agt select { min-width: 180px; max-width: 260px; }
.tt-agt td.tt-agact { white-space: nowrap; }
.tt-agt td.tt-agact .mini + .mini { margin-left: 4px; }
.tt-agt .tt-in input { width: 90px; }
.tt-rvbar { position: sticky; bottom: 0; border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); z-index: 5; }
.tt-rvbar .act.on.armed { background: var(--halt); }
.tt-hfirst td { border-top: 1px solid var(--rule); }
.tt-lt td .tt-pill + small { display: block; margin-top: 3px; max-width: 360px; }

/* ---------- sua ad ---------- */
.tt-adbox { border: 1px solid var(--rule); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tt-adbox .tt-f { margin-bottom: 0; }
.tt-f.grow { flex: 1 1 260px; }
.tt-creas { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.tt-crea { position: relative; border: 1px solid var(--rule); border-radius: var(--r-sm); overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.tt-crea img, .tt-crea .tt-noimg { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: var(--wash); }
.tt-crea .mini { position: absolute; top: 4px; right: 4px; padding: 2px 6px; background: var(--card); }
.tt-crea.add {
  align-items: center; justify-content: center; gap: 4px; min-height: 160px; border-style: dashed; color: var(--slate);
  font-size: 13px; font-weight: 500; padding: 8px; text-align: center;
}
.tt-crea.add:hover { border-color: var(--live); color: var(--live); }
.tt-crea.add small { font-size: 11px; color: var(--mute); font-weight: 400; }
.tt-lib { border-top: 1px dashed var(--rule); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.tt-lib .tt-row { align-items: center; }
.tt-lib .tt-vids { max-height: 360px; }

@media (max-width: 720px) {
  .tt-lbar .tt-q.grow { max-width: none; flex-basis: 100%; }
  .tt-dates input { width: 128px; }
  .tt-modal { padding: 0; }
  .tt-mbox { max-height: 100vh; border-radius: 0; min-height: 100vh; }
  .tt-in input { width: 90px; }
  .tt-rvbar { bottom: -12px; }
}
.tt-mbody .tt-f { flex: 0 0 auto; margin-bottom: 0; }
.tt-mbody .tt-row .tt-f { flex: 1 1 200px; }
.tt-agt td .mini { white-space: nowrap; }
.tt-scope { font-size: 12px; color: var(--slate); background: var(--wash); border-radius: 99px; padding: 3px 4px 3px 10px; display: inline-flex; gap: 6px; align-items: center; }
.tt-scope .mini { padding: 1px 7px; }
.tt-idsel select { max-width: 240px; min-width: 170px; }
.tt-idsel select option:disabled { color: var(--mute); }

/* ---------- Tao moi: bo cuc kieu TikTok Ads Manager ---------- */
.tt-cx { display: grid; grid-template-columns: 190px minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.tt-steps { position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; }
.tt-steps button {
  display: flex; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-radius: var(--r-sm);
  padding: 9px 10px; color: var(--slate); cursor: pointer;
}
.tt-steps button:hover { background: var(--wash); }
.tt-steps button.on { background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink); }
.tt-steps i {
  flex: 0 0 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--rule-3, var(--rule)); font-style: normal;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--slate);
}
.tt-steps button.done i { background: var(--live); border-color: var(--live); color: #fff; font-size: 0; }
.tt-steps button.done i::after { content: "✓"; font-size: 12px; }
.tt-steps span { display: flex; flex-direction: column; min-width: 0; }
.tt-steps b { font-size: 13.5px; font-weight: 600; }
.tt-steps small { font-size: 11.5px; color: var(--mute); }
.tt-cmain { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tt-sec { padding: 18px 20px; scroll-margin-top: 12px; }
.tt-sech { margin: 0 0 4px; font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.tt-sn { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.tt-blk { border-top: 1px solid var(--rule-2); padding-top: 14px; margin-top: 14px; }
.tt-blk h4 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tt-blk h4 .sub { font-weight: 400; font-size: 12px; color: var(--mute); }
.tt-blk h4 .mini { margin-left: auto; }
.tt-obj { border: 1.5px solid var(--live); background: var(--live-bg); border-radius: var(--r); padding: 10px 14px; display: inline-flex; flex-direction: column; margin-bottom: 12px; }
.tt-obj b { font-size: 13.5px; }
.tt-obj small { font-size: 12px; color: var(--slate); }
.tt-sub { margin: 0 0 8px; font-size: 12.5px; color: var(--mute); }
.tt-sub[hidden] { display: none; }
.tt-tabs.sm { margin: 4px 0 12px; }
.tt-tabs.sm button { padding: 7px 12px; font-size: 12.5px; }
.tt-vpane[hidden] { display: none; }
/* khay video da chon */
.tt-seltray { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 4px; }
.tt-seltray .tt-empty { padding: 6px 0; }
.tt-trayit { position: relative; flex: 0 0 74px; border: 1px solid var(--rule); border-radius: var(--r-sm); overflow: hidden; background: var(--card); }
.tt-trayit img, .tt-trayit .tt-noimg { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; display: block; background: var(--wash); }
.tt-trayit small { display: block; font-size: 10.5px; padding: 3px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--slate); }
.tt-trayit .mini { position: absolute; top: 3px; right: 3px; padding: 0 5px; font-size: 11px; background: var(--card); }
/* vung tha file */
.tt-drop-zone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 1.5px dashed var(--rule-3, var(--rule)); border-radius: var(--r); padding: 28px 16px; cursor: pointer; background: var(--paper);
  transition: border-color .12s, background .12s;
}
.tt-drop-zone:hover, .tt-drop-zone.over { border-color: var(--live); background: var(--live-bg); }
.tt-drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.tt-drop-zone b { font-size: 14px; }
.tt-drop-zone small { font-size: 12px; color: var(--mute); max-width: 520px; }
.tt-uplist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.tt-up { display: flex; gap: 12px; align-items: center; border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px 10px; background: var(--card); }
.tt-up img, .tt-up .tt-noimg { flex: 0 0 40px; width: 40px; height: 64px; object-fit: cover; border-radius: 4px; background: var(--wash); }
.tt-upmain { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tt-upmain b { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-upmain small { font-size: 11.5px; color: var(--mute); }
.tt-upmain progress { width: 100%; height: 6px; accent-color: var(--live); }
.tt-up.done .tt-upst { color: var(--live); }
.tt-up.err { border-color: var(--halt); }
.tt-up.err .tt-upst { color: var(--halt); }
.tt-upmain .tt-upwarn { color: var(--warn); }
.tt-upact { display: flex; gap: 4px; }
/* xem truoc */
.tt-prev { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
.tt-phone {
  position: relative; width: 100%; max-width: 260px; aspect-ratio: 9 / 16; margin: 0 auto; border-radius: 26px; overflow: hidden;
  background: #111; border: 6px solid #1b1d22; box-shadow: var(--shadow);
}
.tt-pvmedia { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8b92a0; font-size: 12px; }
.tt-pvmedia img { width: 100%; height: 100%; object-fit: cover; }
.tt-pvover {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 12px 14px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); display: flex; flex-direction: column; gap: 4px;
}
.tt-pvover b { font-size: 13px; }
.tt-pvover p { margin: 0; font-size: 12px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tt-pvspon { font-size: 10.5px; opacity: .8; }
.tt-pvcta { margin-top: 6px; background: #FE2C55; color: #fff; text-align: center; border-radius: 4px; padding: 7px; font-size: 12.5px; font-weight: 600; }
.tt-pvsum { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 0; font-size: 12.5px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px; }
.tt-pvsum dt { color: var(--mute); }
.tt-pvsum dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 1180px) {
  .tt-cx { grid-template-columns: 170px minmax(0, 1fr); }
  .tt-prev { display: none; }
}
@media (max-width: 760px) {
  .tt-cx { grid-template-columns: minmax(0, 1fr); }
  .tt-steps { flex-direction: row; overflow-x: auto; z-index: 6; background: var(--paper); padding: 4px 0; }
  .tt-steps button { flex: 0 0 auto; }
  .tt-steps small { display: none; }
  .tt-sec { padding: 14px; }
}
label.tt-crea.add { position: relative; cursor: pointer; }
label.tt-crea.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ---------- doi tuong: quoc gia / khu vuc / tuoi / ngon ngu ---------- */
.tt-locbar { display: flex; gap: 8px; align-items: flex-start; }
.tt-locbar .tt-tags { flex: 1; max-height: 92px; overflow-y: auto; }
.tt-tag.bad { background: var(--halt-bg); color: var(--halt); border-color: var(--halt); }
.tt-locpick { display: grid; grid-template-columns: 200px minmax(0, 1fr); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--card); }
.tt-locgroups { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-right: 1px solid var(--rule); background: var(--paper); max-height: 360px; overflow-y: auto; }
.tt-lg { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: var(--r-sm); padding: 6px 9px; font-size: 12.5px; color: var(--ink); text-align: left; cursor: pointer; }
.tt-lg:hover { background: var(--wash); }
.tt-lg small { font-size: 11px; color: var(--mute); font-variant-numeric: tabular-nums; }
.tt-lg.some { border-color: var(--rule-3, var(--rule)); background: var(--card); }
.tt-lg.all { border-color: var(--live); background: var(--live-bg); }
.tt-lg.all small { color: var(--live); }
.tt-lg:disabled { opacity: .45; cursor: not-allowed; }
.tt-loclist { display: flex; flex-direction: column; min-width: 0; }
.tt-locq { padding: 8px; border-bottom: 1px solid var(--rule); gap: 6px; align-items: center; flex-wrap: nowrap; }
.tt-locq input { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 7px 9px; font-size: 12.5px; color: var(--ink); }
.tt-locq .mini { white-space: nowrap; }
.tt-locitems, .tt-langitems { max-height: 310px; overflow-y: auto; padding: 4px 8px 8px; }
.tt-lcont > b { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mute); padding: 10px 4px 4px; }
.tt-li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.tt-li:hover { background: var(--wash); }
.tt-li.on { background: var(--live-bg); }
.tt-li small { font-size: 11px; color: var(--mute); white-space: nowrap; }
.tt-li.off { opacity: .5; cursor: not-allowed; }
.tt-li.off.on { opacity: 1; background: var(--halt-bg); }
.tt-li.off small { color: var(--halt); }
.tt-li input { margin: 0; }
#ttLocNote:empty { display: none; }
#ttLocNote .mini { margin-left: 6px; }
.tt-agegroups { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -2px 0 8px; font-size: 13px; }
.tt-agegroups[hidden] { display: none; }
.tt-agegroups label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.tt-langbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tt-langpick { border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); margin-top: 8px; }
.tt-langpick[hidden] { display: none; }
.tt-langpick > input { width: 100%; border: 0; border-bottom: 1px solid var(--rule); padding: 9px 10px; font-size: 12.5px; background: transparent; color: var(--ink); }
.tt-langitems { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 8px; max-height: 220px; }
.tt-fixes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* nhat ky loi */
.tt-badge { font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--halt); color: #fff; border-radius: 99px; padding: 1px 6px; margin-left: 4px; }
.tt-badge[hidden] { display: none; }
.tt-errmsg { display: block; color: var(--halt); font-size: 12.5px; max-width: 520px; overflow-wrap: anywhere; }
.tt-errhint { color: var(--warn) !important; max-width: 520px; }
.tt-errctx { max-width: 420px; overflow-wrap: anywhere; }
.tt-lt tr.tt-new td:first-child { box-shadow: inset 3px 0 0 var(--halt); }
#ttErr .tt-chk { margin: 0; }
@media (max-width: 760px) {
  .tt-locpick { grid-template-columns: minmax(0, 1fr); }
  .tt-locgroups { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--rule); max-height: none; }
  .tt-locq { flex-wrap: wrap; }
}

/* ---------- Len camp Meta ---------- */
.mt { display: none; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); min-height: 0; }
body.view-mt .shell { display: none; }
body.view-mt .mt { display: grid; }
.mt > *, .mt .tt-body > * { min-width: 0; }
.mt .toolbar #mtAcct, .mt .toolbar .ss { max-width: 360px; color: var(--ink); }
.mt .toolbar .chips { flex-wrap: wrap; }
.mt-pool { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--wash); color: var(--slate); cursor: default; white-space: nowrap; }
.mt-pool.ok { background: var(--live-bg); color: var(--live); }
.mt-pool.bad { background: var(--halt-bg); color: var(--halt); cursor: pointer; }
.mt-rvopts { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 14px; }
.mt-rvo { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--slate); }
.mt-rvo > label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); }
.mt-rvo.bad, .mt-rvo .bad { color: var(--halt); }
.mt-tgtsum { display: block; font-size: 12px; color: var(--slate); margin-bottom: 4px; max-width: 260px; }
.mt-adk { display: block; color: var(--mute); }
.mt-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--wash); }
.mt-places { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; }
.mt-places[hidden] { display: none; }
.mt-places label { display: inline-flex; gap: 6px; align-items: center; }
.tt-li.ex.on { background: var(--halt-bg); }
.mt-exnote { padding: 8px 4px 0; }
/* xem truoc kieu Facebook feed */
.mt-fbprev { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
.mt-fbhead { display: flex; gap: 8px; align-items: center; padding: 10px 12px 6px; }
.mt-fbhead > span:last-child { display: flex; flex-direction: column; }
.mt-fbhead b { font-size: 13px; }
.mt-fbhead small { font-size: 11px; color: var(--mute); }
.mt-fbav { width: 32px; height: 32px; border-radius: 50%; background: var(--wash); overflow: hidden; flex: 0 0 32px; }
.mt-fbav img { width: 100%; height: 100%; object-fit: cover; }
.mt-fbprev > p { margin: 0; padding: 0 12px 8px; font-size: 12.5px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.mt-fbmedia { aspect-ratio: 4 / 5; background: #111; display: flex; align-items: center; justify-content: center; color: #8b92a0; font-size: 12px; }
.mt-fbmedia img { width: 100%; height: 100%; object-fit: cover; }
.mt-fbcta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: var(--wash); }
.mt-fbcta > span { display: flex; flex-direction: column; min-width: 0; }
.mt-fbcta small { font-size: 10.5px; color: var(--mute); }
.mt-fbcta b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-fbcta em { font-style: normal; font-size: 12.5px; font-weight: 600; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 10px; white-space: nowrap; }
#tabMtsu .tt-errmsg { font-size: 11.5px; max-width: 320px; }
#tabMtsu td small { display: block; }
@media (max-width: 720px) {
  .mt .toolbar { padding: 10px 12px; }
  .mt .toolbar #mtAcct, .mt .toolbar .ss { max-width: 100%; width: auto; flex: 1 1 100%; }
}
/* nhieu ad group trong form tao moi */
.tt-agbar { margin-top: 10px; }
.tt-agtabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.tt-agtabs > button:not(.mini) { background: var(--wash); border: 1px solid transparent; border-radius: 99px; padding: 5px 12px; font-size: 12.5px; color: var(--slate); cursor: pointer; }
.tt-agtabs > button:not(.mini):hover { color: var(--ink); }
.tt-agtabs > button.on { background: var(--live-bg); border-color: var(--live); color: var(--ink); font-weight: 600; }
.tt-agof { font-size: 12.5px; font-weight: 500; color: var(--mute); }

/* ---- Meta: thong bao loi realtime */
.mt-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 900; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.mt-toast { pointer-events: auto; background: var(--card); color: var(--ink); border: 1px solid var(--rule); border-left: 4px solid var(--halt); border-radius: 10px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.18); font-size: 13px; animation: mtIn .18s ease-out; }
.mt-toast.warn { border-left-color: #d89614; }
.mt-toast.info { border-left-color: var(--live); }
.mt-toast p { margin: 4px 0; line-height: 1.4; word-break: break-word; }
.mt-toast .tt-errhint { display: block; margin-top: 2px; }
.mt-toast-h { display: flex; align-items: baseline; gap: 6px; }
.mt-toast-h small { opacity: .7; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-toast-f { display: flex; justify-content: flex-end; margin-top: 4px; }
.mt-toast.more { display: flex; align-items: center; justify-content: space-between; border-left-color: var(--rule); }
.mt-x { background: none; border: 0; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; padding: 0 2px; }
.mt-x:hover { opacity: 1; }
@keyframes mtIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.mt-lv { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; background: var(--halt); color: #fff; }
.mt-lv.warn { background: #d89614; }
.mt-lv.info { background: var(--live); }

/* ---- o chon tai khoan co tim kiem */
.ss { position: relative; display: inline-block; min-width: 220px; max-width: 100%; }
.tt-f .ss { display: block; width: 100%; }
.ss-native { display: none !important; }
.ss-btn { width: 100%; text-align: left; padding: 7px 30px 7px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.ss-btn::after { content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--slate); border-bottom: 1.5px solid var(--slate); transform: translateY(-70%) rotate(45deg); }
.ss-btn:disabled { opacity: .55; cursor: not-allowed; }
.ss.open .ss-btn { border-color: var(--ink); }
.ss-pop { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(460px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; }
.ss-pop[hidden] { display: none; }
.ss-q { width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); font: inherit; font-size: 13px; background: var(--paper); color: var(--ink); margin-bottom: 4px; }
.ss-list { max-height: 320px; overflow-y: auto; display: block; }
.ss-list button { display: block; width: 100%; height: auto; min-height: 32px; flex: none; line-height: 1.35; text-align: left; border: 0; background: none; color: var(--ink); font: inherit; font-size: 13px; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-list button:hover, .ss-list button.hi { background: var(--wash); }
.ss-list button.on { font-weight: 600; background: var(--live-bg); }
.ss-list button:disabled { opacity: .5; cursor: default; }
.ss-empty { padding: 8px 10px; font-size: 12.5px; color: var(--mute); }

/* ---- Meta: ly do loi chi tiet */
.mt-why { display: block; color: var(--mute); font-size: 11.5px; margin-top: 2px; }

.cms-h { margin: 28px 0 6px; font-size: 14px; }
.mt-rvo .mini { margin-left: 8px; }

/* ---- Meta: len camp theo template ---- */
.mt-tplbox { padding: 14px 16px; margin-bottom: 12px; }
.mt-tplbox .tt-row { gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.mt-tplbox .tt-sub { color: var(--mute); font-size: 12.5px; }
.tt-upbtn { position: relative; overflow: hidden; cursor: pointer; display: inline-flex; align-items: center; }
.tt-upbtn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mt-tpltbl td { vertical-align: top; }
.mt-tpltbl td small { display: block; color: var(--mute); font-size: 11.5px; margin-top: 2px; overflow-wrap: anywhere; }
.mt-tpltbl tr.mute td { opacity: .55; }
.mt-tpltbl .mt-cname { overflow-wrap: anywhere; word-break: break-word; max-width: 360px; display: inline-block; }
.mt-tpltbl .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.mt-langcol select { max-width: 200px; }
.mt-langcol select.bad { border-color: var(--halt); }
.mt-tplbar { position: sticky; bottom: 0; z-index: 2; }
@media (max-width: 720px) { .mt-tpltbl .mt-cname { max-width: 200px; } }

/* ---- thanh tien do chung (barMsg) ---- */
.bar-prog { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; margin-left: 10px; }
.bar-prog progress { width: 160px; height: 6px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: var(--wash); overflow: hidden; }
.bar-prog progress::-webkit-progress-bar { background: var(--wash); border-radius: 99px; }
.bar-prog progress::-webkit-progress-value { background: var(--live); border-radius: 99px; transition: width .3s; }
.bar-prog progress::-moz-progress-bar { background: var(--live); border-radius: 99px; }
.bar-prog progress:indeterminate { background: linear-gradient(90deg, var(--wash) 0%, var(--live) 50%, var(--wash) 100%); background-size: 200% 100%; animation: barslide 1.2s linear infinite; }
.bar-prog progress:indeterminate::-webkit-progress-bar { background: transparent; }
.bar-prog progress:indeterminate::-moz-progress-bar { background: transparent; }
.bar-prog b { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--slate); min-width: 34px; }
.bar-prog.row { display: flex; margin: 4px 0 0; }
.bar-prog.row progress { width: 110px; }
.tt-barmsg.run::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--live); animation: barpulse 1s ease-in-out infinite; vertical-align: 1px; }
.tt-barmsg.warn { color: var(--warn); }
@keyframes barslide { from { background-position: 200% 0; } to { background-position: 0 0; } }
@keyframes barpulse { 50% { opacity: .25; } }
@media (max-width: 720px) { .bar-prog progress { width: 90px; } }

/* ---- khu vuc kiem soat Meta ---- */
.mt-reg .tt-sub { margin: 0 0 8px; }
.mt-regrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
.mt-regrow > b { min-width: 80px; }
.mt-regrow > small.mono { color: var(--mute); font-size: 11px; }
.mt-regrow label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--mute); min-width: 220px; flex: 1; }
.mt-regrow label input { margin-top: 3px; }
.mt-regrow > small.bad { flex-basis: 100%; }
#mtTgtM.mt-nolang .tt-f:has(> .tt-langbar) { display: none; }
.mt-tpltbl .mt-tgtcol { font-size: 12px; color: var(--slate); max-width: 260px; }
.mt-tpltbl .mt-tgtcol span { overflow-wrap: anywhere; }
#mtTplLangSel { max-width: 220px; }
.legal-links { margin: 14px 0 0; font-size: 12px; color: var(--mute); text-align: center; } .legal-links a { color: inherit; }

/* ---- Sua hang loat ban nhap (kieu Meta) ---- */
.mt-bd { max-width: 820px; }
.mt-bdtabs { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.mt-bdtabs .bd-n { font-style: normal; font-size: 11px; background: var(--live); color: #fff; border-radius: 99px; padding: 0 6px; margin-left: 4px; }
#mtBDBody { padding-top: 4px; }
.bd-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 8px 16px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.bd-row:last-child { border-bottom: 0; }
.bd-row.on { background: color-mix(in srgb, var(--live) 6%, transparent); margin: 0 -18px; padding: 12px 18px; }
.bd-lab b { display: block; font-size: 13.5px; }
.bd-lab small { display: block; color: var(--mute); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.bd-cur { font-size: 13px; color: var(--slate); padding-top: 2px; overflow-wrap: anywhere; }
.bd-mix { color: var(--mute); font-style: italic; }
.bd-val .bd-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.bd-val .bd-line input { flex: 1; min-width: 120px; }
.bd-val select, .bd-val textarea, .bd-val > input { width: 100%; }
.bd-val .bd-line select { width: auto; }
.bd-val small.warn { display: block; color: var(--warn); font-size: 12px; }
.bd-tw { border: 1px solid var(--rule); border-radius: var(--r); padding: 10px; }
@media (max-width: 700px) { .bd-row { grid-template-columns: 1fr auto; } .bd-val { grid-column: 1 / -1; grid-row: 2; } .bd-row.on { margin: 0 -12px; padding: 12px; } }
#mtBDM .tt-mfoot { flex-wrap: wrap; row-gap: 8px; } #mtBDMsg { flex-basis: 100%; }

/* ============================ Ads Manager ============================ */
/* Man Meta / TikTok nam trong khung chinh, canh cot tai khoan (app.js chuyen #mt / #tt vao .shell). */
body.view-mt .shell, body.view-tt .shell { display: grid; }
body.view-mt .shell > main, body.view-tt .shell > main { display: none; }
.shell > .mt, .shell > .tt { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto auto; }
/* dong trang thai / nhat ky (.dock) chuyen theo man; thanh chon cua bang campaign khong dung o day */
.mt .dock .bulk, .tt .dock .bulk { display: none !important; }
/* chon tai khoan o cot trai — bo o chon rieng cua man */
.shell #mtAcct, .shell #ttAcct, .shell .mt .toolbar > .ss, .shell .tt .toolbar > .ss { display: none !important; }
@media (max-width: 860px) {
  .shell > .mt, .shell > .tt { grid-column: 1; grid-row: 2; }
}
/* thanh thao tac nhanh khi chon dong */
.am-quick { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.am-quick .am-bud { display: inline-flex; align-items: center; gap: 4px; }
.am-quick select, .am-quick input { height: 26px; font-size: 12px; }
.am-quick input { width: 72px; }
/* o so tien bam de sua tren bang Meta / TikTok */
.tt-lt button.bud { font: inherit; }
.tt-lt td.num.good { color: var(--live); font-weight: 550; }
.tt-lt td.num.bad { color: var(--halt); font-weight: 550; }
.tt-lt th.biz, .tt-lt td.biz { background: color-mix(in srgb, var(--live) 4%, transparent); }
.tt-lt .hlink { margin-left: 6px; }

/* CMS: tai khoan theo app */
.aa-grid { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .aa-grid { grid-template-columns: 1fr; } }
.aa-apps input, .aa-addbar input { width: 100%; margin-bottom: 8px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 8px 10px; font-size: 13px; outline: none; }
.aa-apps input:focus, .aa-addbar input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,22,26,.06); }
.picker.aa-applist { max-height: 560px; padding: 4px; }
.aa-app { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 8px; cursor: pointer; color: inherit; font: inherit; }
.aa-app:hover { background: var(--wash); }
.aa-app.on { background: var(--live-bg); }
.aa-app b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-app code { font: 11px var(--mono); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-app small { color: var(--mute); font-size: 12px; }
.aa-h { margin: 0 0 6px; font-size: 15px; }
.aa-h code { font: 12px var(--mono); color: var(--mute); font-weight: 400; }
.aa-users { font-size: 13px; color: var(--mute); margin-bottom: 10px; }
.aa-sec { margin-bottom: 16px; }
.aa-sec > .head { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); margin-bottom: 6px; }
.aa-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--rule-2); }
.aa-acc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-acc b { font-weight: 500; }
.aa-acc small, .aa-by { color: var(--mute); font-size: 12px; }
.aa-dup { color: var(--mute); }
.aa-addbar { display: flex; gap: 8px; align-items: flex-start; }
.aa-addbar input { flex: 1; }
.aa-addbar button { white-space: nowrap; }
.picker.aa-cand { max-height: 300px; }
.picker.aa-cand label.on { background: var(--live-bg); }
.aa-auto { max-height: 260px; overflow: auto; }

/* Sua hang loat: o nhap co nhan (ten campaign) */
.bd-in { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; margin: 0; }
.bd-in > span { font-size: 11px; color: var(--mute); font-weight: 500; }
.bd-in > input { width: 100%; }

/* Ads Manager: so ngan sach bam sua duoc — hien but chi de de thay; nut Xoa tren dong */
.tt-lt button.bud { border: 1px dashed var(--rule); border-radius: 5px; padding: 1px 6px; margin: 0; cursor: pointer; }
.tt-lt button.bud::after { content: ' ✎'; color: var(--mute); font-size: 11px; }
.tt-lt button.bud:hover { border-style: solid; border-color: var(--ink); }
.tt-act { white-space: nowrap; }
.tt-act .mini + .mini { margin-left: 4px; }

.hlink.del { color: var(--halt); }
.hlink.del:hover { text-decoration: underline; }
.tt-lt button.bud { white-space: nowrap; }
.am-quick select { padding: 0 6px; line-height: 24px; }

/* Ads Manager: thanh loc + tab / thanh thao tac + ten cot dung yen o dau, chi bang cuon (man rong; man hep van cuon ca trang) */
@media (min-width: 861px) {
  #mtList:not([hidden]), #ttList:not([hidden]) { flex: 1 1 auto; min-height: 0; }
  .tt-body:has(> #mtList:not([hidden])), .tt-body:has(> #ttList:not([hidden])) { overflow: hidden; }
  #mtList > .tt-tablewrap, #ttList > .tt-tablewrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
  #mtList .tt-lt thead th, #ttList .tt-lt thead th { position: sticky; top: 0; z-index: 3; background: var(--card); }
  #mtList .tt-lt thead th.biz, #ttList .tt-lt thead th.biz { background: color-mix(in srgb, var(--live) 4%, var(--card)); }
}

/* CMS: chi tiet luot gan nhat + nhat ky thu gon mac dinh (khong dai trang); mo ra thi cuon trong khung */
.cmslog > summary { cursor: pointer; font-weight: 600; padding: 6px 0; user-select: none; }
.cmslog > summary .sub { font-weight: 400; }
.cmslog[open] > summary { margin-bottom: 8px; }
.cmslog .hint { max-height: 240px; overflow: auto; }
.cmslog .tscroll { max-height: 420px; overflow: auto; }
.cmslog .tscroll thead th { position: sticky; top: 0; z-index: 1; }

/* Ads Manager: hang tong / da chon dinh duoi ten cot */
.tt-lt thead tr.am-tot th { font-size: 13px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--rule-2); background: var(--wash) !important; }
.tt-lt thead tr.am-tot th small { display: block; font-weight: 400; color: var(--mute); font-size: 11px; }
.tt-lt thead tr.am-tot.sel th { background: color-mix(in srgb, var(--live) 10%, var(--card)) !important; }
.tt-lt thead tr.am-tot .am-totl { white-space: nowrap; }
.tt-lt thead tr.am-tot th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tt-lt thead tr.am-tot.sel.none th { background: var(--card) !important; font-weight: 400; }
.tt-lt thead tr.am-tot.sel.none small { display: inline; }
.am-quick.am-off { visibility: hidden; }
/* Hang doi thao tac (Ads Manager): bang tien trinh goc duoi phai */
.am-jobs { position: fixed; right: 16px; bottom: 48px; z-index: 60; width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 6px; }
.am-job { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 10px 10px; font-size: 12.5px; }
.am-job-h { display: flex; align-items: center; gap: 8px; }
.am-job-h b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.am-job-h span { color: var(--slate); font-variant-numeric: tabular-nums; white-space: nowrap; }
.am-job-h .mini { padding: 0 6px; }
.am-job > i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--live); transition: width .25s; }
.am-job.wait > i { background: var(--mute); }
.am-job.bad > i { background: var(--halt); }
.am-job.bad .am-job-h span { color: var(--halt); }
/* dang gui len nen tang: nut bat tat / o ngan sach mo nhe + nhap nhay */
.tt-tog.pend span { opacity: .55; animation: amPend 1s ease-in-out infinite alternate; }
.bud.pend { opacity: .6; font-style: italic; animation: amPend 1s ease-in-out infinite alternate; }
@keyframes amPend { from { opacity: .75; } to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tt-tog.pend span, .bud.pend { animation: none; } }
.tt-lt thead tr.am-tot th { height: 40px; box-sizing: border-box; }
.mt-sched { display: block; color: var(--mute); font-size: 11px; margin-top: 3px; }
.lim-stats { margin: 6px 0 10px; }
.lim-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(210px, 1fr)); gap:8px; }
.lim-kv { border:1px solid var(--rule); border-radius:8px; padding:8px 10px; display:flex; flex-direction:column; gap:2px; }
.lim-kv span { color:var(--mute); font-size:11px; }
.lim-kv b { font-size:16px; }
.lim-kv small { color:var(--mute); font-size:11px; }
.lim-sub { color:var(--mute); font-size:12px; margin:8px 0; }
.lim-top { margin-top:6px; max-width:560px; }
.aa-mis { margin-bottom: 12px; }
.aa-mis .head .mini { margin-left: 8px; }
.aa-misrow { align-items: center; }
.aa-misrow .aa-acc small { display: block; }
.aa-misbtn { display: flex; gap: 6px; flex-shrink: 0; }
.aa-mis .aa-sec { max-height: 440px; overflow: auto; }

/* Bo loc nhieu dieu kien (Ads Manager) */
.am-flt { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; font-size: 12.5px; position: relative; }
.am-flt .flt-ic { color: var(--mute); font-size: 13px; }
.am-flt .flt-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; border-radius: 14px; background: var(--wash); border: 1px solid var(--slate); cursor: pointer; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-flt .flt-chip.ed { box-shadow: 0 0 0 2px var(--slate); }
.am-flt .flt-chip.off { opacity: .45; border-style: dashed; cursor: default; }
.am-flt .flt-chip .x { border: 0; background: none; padding: 0 5px; cursor: pointer; font-size: 14px; line-height: 1; color: inherit; }
.am-flt .flt-add { border: 1px dashed var(--rule); background: none; border-radius: 14px; padding: 3px 10px; cursor: pointer; color: inherit; font-size: 12.5px; }
.am-flt .flt-add:hover { border-color: var(--slate); }
.am-flt .flt-form { flex-basis: 100%; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); }
.am-flt .flt-form input[name="v"] { min-width: 220px; }
.am-flt .flt-opts { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; max-width: 640px; }
.am-flt .flt-opts label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* TikTok review: kenh TikTok */
.tt-rvhead .tt-rvid { min-width: 220px; max-width: 300px; }
.tt-rvhead .tt-rvid select { width: 100%; }
.tt-idsel small .ok { color: var(--live); }
.tt-idsel small .bad, .tt-idsel small.bad { color: var(--halt); }
