/* ============================================================
   Dream Media — App Dashboard v2
   Thiet ke lai toan bo: chieu sau, mau thuong hieu tung nen tang,
   chuyen dong muot, trang thai hover/focus ro rang.
   ============================================================ */

:root {
  --app-bg: #0a0c14;
  --app-surface: #10131f;
  --app-surface-2: #161a2b;
  --app-surface-3: #1d2236;
  --app-border: #232941;
  --app-border-soft: #1b2036;
  --ring: rgba(124, 92, 255, .45);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, .12);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, .12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .12);
  --yt: #ff0033;
  --fb: #1877f2;
  --ig-grad: linear-gradient(45deg, #f58529, #dd2a7b 55%, #8134af);
  --tt-grad: linear-gradient(135deg, #00f2ea, #ff0050);
  --x-bg: #16181c;
  --shadow-card: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -18px rgba(0,0,0,.8);
  --shadow-pop: 0 24px 60px -20px rgba(0,0,0,.75);
}

html, body { height: 100%; margin: 0; }
body { background: var(--app-bg); }

::selection { background: rgba(124,92,255,.35); }

/* Scrollbar tinh te */
.app-content::-webkit-scrollbar { width: 10px; }
.app-content::-webkit-scrollbar-thumb { background: var(--app-border); border-radius: 99px; border: 3px solid var(--app-bg); }
.app-content::-webkit-scrollbar-track { background: transparent; }

.app-shell {
  display: flex;
  height: 100vh;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(124,92,255,.10), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(34,211,238,.06), transparent 60%),
    var(--app-bg);
  color: var(--text);
}

/* ==================== SIDEBAR ==================== */
.app-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: rgba(13, 16, 27, .7);
  border-right: 1px solid var(--app-border-soft);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  backdrop-filter: blur(14px);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 10px 24px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.02em;
}
.app-brand img { width: 28px; height: 28px; border-radius: 9px; box-shadow: 0 0 18px rgba(124,92,255,.5); }

.app-nav-group { margin-bottom: 20px; }
.app-nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  opacity: .7;
  padding: 0 12px;
  margin-bottom: 8px;
  font-weight: 700;
}
.app-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.8px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  margin-bottom: 3px;
  transition: color .15s ease, background .15s ease;
}
.app-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.app-nav-item:hover { color: var(--text); background: rgba(255,255,255,.03); }
.app-nav-item.active {
  background: linear-gradient(90deg, rgba(124,92,255,.16), rgba(124,92,255,.05));
  color: var(--text);
}
.app-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: var(--accent-grad);
  box-shadow: 0 0 12px rgba(124,92,255,.8);
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--app-surface-3);
  border: 1px solid var(--app-border);
  color: var(--text-dim);
  padding: 1px 8px;
  border-radius: 99px;
}
.app-nav-item.active .nav-count { color: #cabdff; border-color: rgba(124,92,255,.4); }

/* Magic Post — nav noi bat + badge */
.magic-nav {
  background: linear-gradient(90deg, rgba(124,92,255,.14), rgba(34,211,238,.05));
  border: 1px solid rgba(124,92,255,.25) !important;
  color: var(--text) !important;
}
.magic-nav:hover { border-color: rgba(124,92,255,.5) !important; }
.magic-nav svg { color: #c3b5ff; opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 800;
  background: var(--accent-grad); color: #fff;
  padding: 2px 7px; border-radius: 99px; letter-spacing: .02em;
}

/* Storage — thanh dung luong */
.st-bar {
  height: 12px; border-radius: 99px; overflow: hidden;
  background: var(--app-surface-3); border: 1px solid var(--app-border-soft);
}
.st-bar-fill {
  height: 100%; border-radius: 99px; background: var(--accent-grad);
  transition: width .5s cubic-bezier(.22,1,.36,1), background .3s ease;
  min-width: 2px;
}
.st-bar-fill.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.st-bar-fill.full { background: linear-gradient(90deg, #dc2626, #f87171); }
.st-legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: 11px; font-size: 12.5px; color: var(--text-dim);
}
.st-legend b { color: var(--text); }

.st-alert {
  padding: 12px 15px; border-radius: 11px; margin-bottom: 10px;
  font-size: 13px; line-height: 1.6;
}
.st-alert.error { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.35); color: #fca5a5; }
.st-alert.warn  { background: rgba(251,191,36,.09); border: 1px solid rgba(251,191,36,.3); color: #fcd34d; }
.st-alert.info  { background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.25); color: #7fe3f2; }

.st-help {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 4px;
  background: rgba(124,92,255,.07); border: 1px solid rgba(124,92,255,.22);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.65;
}
.st-help b { color: var(--text); }
.st-help a { color: var(--accent-2); font-weight: 600; }

/* Nut Connect (OAuth) */
.connect-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.connect-card-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 15px 15px 14px; border-radius: 12px; cursor: pointer; text-align: left;
  border: 1px solid var(--app-border); background: var(--app-surface-2);
  color: var(--text); font-family: inherit; transition: all .17s ease;
}
.connect-card-btn:hover:not(:disabled) {
  border-color: var(--accent); background: rgba(124,92,255,.07); transform: translateY(-2px);
}
.connect-card-btn.off { opacity: .45; cursor: not-allowed; }
.connect-card-btn .platform-dot { width: 34px; height: 34px; flex: none; }
.connect-card-btn .cc-text { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.connect-card-btn .cc-name { font-size: 14px; font-weight: 700; }
.connect-card-btn .cc-note { font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.connect-card-btn .cc-go { font-size: 12px; font-weight: 700; color: var(--accent-2); }
.connect-card-btn.off .cc-go { color: var(--text-dimmer); }
/* Nut trong the (Connect / Paste token) tran ngang day cho de bam */
.connect-card-btn > .btn { width: 100%; justify-content: center; margin-top: 2px; }

/* Autopilot — chon so ngay */
.dur-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dur-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 12px 4px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--app-border); background: var(--app-surface-2);
  color: var(--text-dim); font-family: inherit; transition: all .16s ease;
}
.dur-chip:hover { color: var(--text); border-color: #2e3554; transform: translateY(-1px); }
.dur-chip .n { font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.dur-chip .u { font-size: 10.5px; opacity: .8; }
.dur-chip.on {
  background: var(--accent-grad); color: #fff; border-color: transparent;
  box-shadow: 0 8px 22px -8px rgba(124,92,255,.75);
}

/* Autopilot — bang tom tat */
.ap-summary {
  margin-top: 18px; border: 1px solid var(--app-border); border-radius: 12px;
  background: var(--app-surface-2); padding: 4px 14px;
}
.ap-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; font-size: 13px; color: var(--text-dim);
  border-bottom: 1px solid var(--app-border-soft);
}
.ap-row:last-child { border-bottom: none; }
.ap-row b { color: var(--text); font-size: 14px; }
.ap-row b.ok { color: var(--green); }
.ap-row b.warn { color: var(--yellow); }
.ap-warn {
  margin: 4px 0 10px; padding: 10px 12px; border-radius: 9px;
  background: rgba(251,191,36,.09); border: 1px solid rgba(251,191,36,.3);
  color: #fcd34d; font-size: 12px; line-height: 1.55;
}

/* Select trong form */
.m-select {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--app-border); background: var(--app-surface-2);
  color: var(--text); font-family: inherit; font-size: 14px;
  cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
.m-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.15); }

.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

.sidebar-upsell {
  margin-top: auto;
  border: 1px solid var(--app-border);
  background: linear-gradient(160deg, rgba(124,92,255,.14), rgba(34,211,238,.06));
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.sidebar-upsell .t { font-size: 13px; font-weight: 800; margin-bottom: 4px; }
.sidebar-upsell .s { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin-bottom: 12px; }
.sidebar-upsell a {
  display: block; text-align: center;
  font-size: 12.5px; font-weight: 700;
  background: var(--accent-grad); color: #fff;
  padding: 8px 0; border-radius: 9px;
}

.app-sidebar-footer { border-top: 1px solid var(--app-border-soft); padding-top: 12px; }
.app-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.app-user-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.app-user-name { font-size: 13px; font-weight: 700; }
.app-user-email { font-size: 11.5px; color: var(--text-dim); }

/* ==================== MAIN ==================== */
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--app-border-soft);
  background: rgba(13, 16, 27, .6);
  backdrop-filter: blur(14px);
  flex-shrink: 0;
}
.app-search {
  flex: 1; max-width: 380px;
  display: flex; align-items: center; gap: 9px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  padding: 9px 13px;
  color: var(--text-dim);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.app-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.15); }
.app-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.app-search input {
  border: none; background: transparent; outline: none; color: var(--text);
  font-family: inherit; font-size: 13.5px; width: 100%;
}
.app-topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--app-border); background: var(--app-surface);
  color: var(--text-dim); cursor: pointer; position: relative;
  transition: color .15s ease, border-color .15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); box-shadow: 0 0 6px var(--red); }

.app-content { flex: 1; overflow-y: auto; padding: 30px 34px 70px; }

/* Chuyen canh giua cac view */
.app-view { display: none; }
/* Cap be rong noi dung + can giua: man sieu rong (2K/4K) khong bi gian
   qua co (tranh khoang trong lon giua tieu de va nut). Laptop <=~1600 van day. */
.app-view.active { display: block; max-width: 1560px; margin: 0 auto;
  animation: viewIn .35s cubic-bezier(.22,1,.36,1); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-view-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 14px; }
.app-view-head h2 { font-size: 24px; margin: 0 0 5px; font-weight: 800; letter-spacing: -.02em; }
.app-view-head p { margin: 0; color: var(--text-dim); font-size: 13.5px; }

/* ==================== CARDS & STATS ==================== */
.astat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.astat-card {
  position: relative;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}
.astat-card:hover { transform: translateY(-2px); border-color: #2e3554; }
.astat-card::after {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--accent-grad);
  opacity: 0; transition: opacity .2s ease;
}
.astat-card:hover::after { opacity: 1; }
.astat-card .l { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; font-weight: 600; letter-spacing: .02em; }
.astat-card .n { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.astat-card .d { font-size: 11.5px; margin-top: 10px; font-weight: 700; }
.d-up { color: var(--green); }
.d-down { color: var(--red); }
.d-dim { color: var(--text-dim); }

.chart-card, .table-card, .settings-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}
.chart-card { padding: 22px 24px 14px; margin-bottom: 20px; }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.chart-card-head h4 { margin: 0; font-size: 14.5px; font-weight: 700; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-dim); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.two-col { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; align-items: start; }
/* min-width:0 la BAT BUOC, khong phai trang tri.
   O lui mac dinh la min-width:auto -> no khong co duoc nho hon noi dung ben
   trong. Cot phai cua man Schedule chua .pv-grid dung repeat(auto-fill,...),
   nen sinh ra mot vong luan quan: luoi phinh theo noi dung, roi auto-fill lai
   tinh so cot theo be rong da phinh. Ket qua do duoc tren production:
   grid-template-columns = "54px 2387.96px" — cot trai (ca cai form nhap bai)
   sap con 54px, chu roi doc tung ky tu mot. */
.two-col > * { min-width: 0; }

/* ==================== TABLES ==================== */
.table-card { overflow: hidden; }
.table-card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--app-border-soft); }
.table-card-head h4 { margin: 0; font-size: 14.5px; font-weight: 700; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
.data-table th {
  text-align: left; color: var(--text-dim); font-weight: 700;
  padding: 11px 14px; border-bottom: 1px solid var(--app-border-soft);
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--app-border-soft); }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: rgba(255,255,255,.018); }
.data-table tr:last-child td { border-bottom: none; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-posted { background: var(--green-bg); color: var(--green); }
.status-pending { background: var(--yellow-bg); color: var(--yellow); }
.status-failed { background: var(--red-bg); color: var(--red); }
.status-posting { background: rgba(34,211,238,.12); color: var(--accent-2); }

.filter-row { display: flex; gap: 8px; padding: 14px 22px; border-bottom: 1px solid var(--app-border-soft); flex-wrap: wrap; }
.filter-chip {
  padding: 7px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--app-border); color: var(--text-dim); cursor: pointer;
  background: var(--app-surface-2);
  transition: all .15s ease;
}
.filter-chip:hover { color: var(--text); border-color: #2e3554; }
.filter-chip.active { background: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px -4px rgba(124,92,255,.5); }

/* ==================== PLATFORM BADGES ==================== */
.platform-dot {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.platform-dot svg { width: 17px; height: 17px; fill: #fff; }
.pd-youtube { background: var(--yt); box-shadow: 0 4px 14px -4px rgba(255,0,51,.5); }
.pd-facebook { background: var(--fb); box-shadow: 0 4px 14px -4px rgba(24,119,242,.5); }
.pd-instagram { background: var(--ig-grad); box-shadow: 0 4px 14px -4px rgba(221,42,123,.5); }
.pd-tiktok { background: #000; border: 1px solid #333; position: relative; }
.pd-x { background: var(--x-bg); border: 1px solid #333; }
.pd-linkedin { background: #0a66c2; }
.pd-threads { background: #000; border: 1px solid #333; }
.c-linkedin { background: #0a66c2; }
.c-threads { background: #000; }

.account-row-left { display: flex; align-items: center; gap: 13px; }
.account-meta .name { font-weight: 700; font-size: 13.5px; }
.account-meta .sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }

/* Account cards */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
#account-grid { display: block; }  /* chua cac cum nen tang -> xep doc */
.account-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: transform .2s ease, border-color .2s ease;
}
.account-card:hover { transform: translateY(-2px); border-color: #2e3554; }
.account-card-top { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.account-card .meta { flex: 1; min-width: 0; }
.account-card .meta .name { font-weight: 800; font-size: 14.5px; }
.account-card .meta .sub { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.account-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-sync { font-size: 11.5px; color: var(--text-dim); }

.chip-connected {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; color: var(--green);
  background: var(--green-bg); border: 1px solid rgba(52,211,153,.3);
  padding: 4px 11px; border-radius: 999px;
}
.chip-connected::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.chip-off {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; color: var(--text-dim);
  background: var(--app-surface-2); border: 1px solid var(--app-border);
  padding: 4px 11px; border-radius: 999px;
}

.btn-sm { padding: 7px 15px !important; font-size: 12.5px !important; border-radius: 9px !important; }

/* ==================== QUEUE ==================== */
.queue-item { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--app-border-soft); }
.queue-item:last-child { border-bottom: none; }
.queue-time { font-size: 11.5px; color: var(--text-dim); width: 76px; flex-shrink: 0; line-height: 1.45; font-weight: 600; }
.queue-info { min-width: 0; flex: 1; }
.queue-info .t { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-info .s { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.queue-dots { display: flex; gap: 4px; flex-shrink: 0; }
.queue-dots .platform-dot { width: 24px; height: 24px; border-radius: 7px; }
.queue-dots .platform-dot svg { width: 12px; height: 12px; }
.queue-empty { padding: 28px 0; text-align: center; color: var(--text-dim); font-size: 13px; }

/* ==================== SCHEDULE FORM ==================== */
.dropzone {
  border: 1.5px dashed var(--app-border);
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--app-surface-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.has-file { border-color: var(--accent); background: rgba(124,92,255,.06); }
.dropzone .dz-icon { font-size: 26px; margin-bottom: 8px; }
.dropzone.has-file { color: var(--text); font-weight: 600; }

.pf-select { display: flex; flex-wrap: wrap; gap: 9px; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 11px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-2);
  color: var(--text-dim);
  font-size: 13px; font-weight: 700;
  cursor: pointer; user-select: none;
  transition: all .15s ease;
}
.pf-chip svg { width: 15px; height: 15px; fill: currentColor; }
.pf-chip:hover { color: var(--text); border-color: #2e3554; }
.pf-chip.on { color: #fff; border-color: transparent; }
.pf-chip.on.c-youtube { background: var(--yt); box-shadow: 0 4px 16px -6px var(--yt); }
.pf-chip.on.c-facebook { background: var(--fb); box-shadow: 0 4px 16px -6px var(--fb); }
.pf-chip.on.c-instagram { background: var(--ig-grad); box-shadow: 0 4px 16px -6px #dd2a7b; }
.pf-chip.on.c-tiktok { background: #000; border-color: #444; box-shadow: 0 4px 16px -6px #00f2ea; }
.pf-chip.on.c-x { background: #000; border-color: #444; }
.pf-chip.disabled { opacity: .4; cursor: not-allowed; }

.form-panel { padding: 24px 26px; }
.form-panel .field { margin-bottom: 18px; }
.form-panel label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 8px; color: var(--text-dim); }
.form-panel input[type="text"], .form-panel input[type="datetime-local"], .form-panel textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-panel input:focus, .form-panel textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,255,.15);
}
.form-panel textarea { min-height: 96px; resize: vertical; }
.char-note { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }
.char-note b { color: var(--yellow); }

/* Preview */
.post-preview {
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  overflow: hidden;
}
.post-preview .pv-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; }
.post-preview .pv-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-grad); }
.post-preview .pv-name { font-size: 13px; font-weight: 700; }
.post-preview .pv-sub { font-size: 11px; color: var(--text-dim); }
.post-preview .pv-media {
  aspect-ratio: 9/12; max-height: 260px; width: 100%;
  background:
    radial-gradient(circle at 30% 30%, rgba(124,92,255,.35), transparent 60%),
    radial-gradient(circle at 75% 70%, rgba(34,211,238,.3), transparent 55%),
    var(--app-surface-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 34px;
}
.post-preview .pv-caption { padding: 13px 15px; font-size: 13px; line-height: 1.55; color: var(--text); word-break: break-word; }
.post-preview .pv-caption .tags { color: var(--accent-2); }

/* ==================== SETTINGS ==================== */
.settings-card { padding: 22px 24px; margin-bottom: 18px; }
.settings-card h4 { margin: 0 0 4px; font-size: 14.5px; font-weight: 800; }
.settings-card .sub { color: var(--text-dim); font-size: 12.5px; margin: 0 0 18px; }
.settings-card .field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 8px; color: var(--text-dim); }
.settings-card .field input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--app-border); background: var(--app-surface-2);
  color: var(--text); font-family: inherit; font-size: 14px; box-sizing: border-box;
}

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--app-border-soft); gap: 16px; }
.toggle-row:last-child { border-bottom: none; padding-bottom: 4px; }
.toggle-row .t { font-size: 13.8px; font-weight: 700; }
.toggle-row .s { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.toggle-switch { position: relative; width: 42px; height: 24px; background: var(--app-surface-3); border: 1px solid var(--app-border); border-radius: 999px; cursor: pointer; flex-shrink: 0; transition: all .2s ease; }
.toggle-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-dim); transition: transform .2s cubic-bezier(.22,1,.36,1), background .2s ease; }
.toggle-switch.on { background: rgba(124,92,255,.3); border-color: var(--accent); }
.toggle-switch.on::after { transform: translateX(18px); background: var(--accent); box-shadow: 0 0 8px rgba(124,92,255,.7); }

.danger-zone { border: 1px solid rgba(248,113,113,.35); background: rgba(248,113,113,.05); border-radius: 16px; padding: 20px 22px; }
.danger-zone h4 { margin: 0 0 6px; font-size: 14px; color: var(--red); }
.danger-zone p { margin: 0 0 14px; font-size: 13px; color: var(--text-dim); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,113,113,.4); }

/* ==================== TOAST ==================== */
.toast-wrap { position: fixed; bottom: 26px; right: 26px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px;
  background: var(--app-surface-3);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-pop);
  animation: toastIn .3s cubic-bezier(.22,1,.36,1);
  max-width: 360px;
}
.toast.out { animation: toastOut .25s ease forwards; }
.toast .tk { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast.ok .tk { background: var(--green); box-shadow: 0 0 8px var(--green); }
.toast.warn .tk { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* Badge demo */
.badge-demo { white-space: nowrap; }

/* Empty state */
.empty-state { padding: 50px 22px; text-align: center; color: var(--text-dim); }
.empty-state .e-icon { font-size: 42px; margin-bottom: 12px; opacity: .95;
  filter: drop-shadow(0 4px 14px rgba(124,92,255,.25)); }
.empty-state .e-t { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.empty-state .e-s { font-size: 13px; line-height: 1.55; max-width: 360px; margin: 0 auto; }
.empty-state .e-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; }
.queue-empty { text-align: center; padding: 26px 14px; color: var(--text-dim); font-size: 13px; }
.queue-empty .e-cta { display: inline-flex; margin-top: 12px; }

/* Grid helper */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1080px) {
  .astat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
/* ===== MOBILE ===== */
.m-tabbar, .m-scrim { display: none; }

@media (max-width: 920px) {
  /* Sidebar -> ngan keo truot tu trai (mo bang nut Menu o thanh day) */
  .app-sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 70;
    width: min(300px, 84vw);
    transform: translateX(-105%);
    transition: transform .25s ease;
    background: rgba(11, 13, 22, .98);
    overflow-y: auto;
  }
  .app-sidebar.open { transform: translateX(0); box-shadow: 24px 0 60px rgba(0,0,0,.5); }
  .m-scrim.show { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.55); }

  /* Thanh dieu huong day kieu app */
  .m-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(13, 16, 27, .96);
    border-top: 1px solid var(--app-border-soft);
    backdrop-filter: blur(14px);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .m-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: 0; cursor: pointer;
    color: var(--text-dim); font: 600 10.5px/1 Inter, system-ui, sans-serif;
    padding: 7px 2px; border-radius: 10px; min-height: 48px;
  }
  .m-tab svg { width: 21px; height: 21px; }
  .m-tab.active { color: var(--accent-2, #60a5fa); }

  .app-content { padding: 18px 14px calc(88px + env(safe-area-inset-bottom)); }
  .astat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-2, .two-col { grid-template-columns: 1fr; gap: 16px !important; }

  /* Bang rong -> cuon ngang trong the, khong keo ca trang */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 560px; }

  /* Ngon tay cham thoai mai: o nhap toi thieu 44px */
  .m-input, .m-select, input[type="text"], input[type="password"],
  input[type="email"], input[type="datetime-local"], select, textarea { min-height: 44px; font-size: 16px; }
  .btn { min-height: 42px; }

  /* Modal chiem gan het man hinh nho */
  .modal-card { width: 94vw; max-width: 94vw; max-height: 86vh; overflow-y: auto; }

  .app-view-head { flex-wrap: wrap; gap: 10px; }
  .app-topbar { padding: 10px 14px; }
}

@media (max-width: 480px) {
  .astat-grid { grid-template-columns: 1fr 1fr; }
  .apc-grid { gap: 3px; }
  .dur-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===== AUTOPILOT: xem truoc & duyet ===== */
.ap-review-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:14px; }
.ap-review-t { font-weight:800; font-size:14px; letter-spacing:-.01em; }
.ap-review-s { font-size:12px; color:var(--text-dim); margin-top:3px; }
.btn-sm { padding:5px 10px; font-size:11.5px; }

#ap-plan-list { max-height:520px; overflow-y:auto; padding-right:4px; margin:0 -2px; }

.ap-item {
  display:flex; gap:11px; align-items:flex-start; cursor:pointer;
  border:1px solid var(--app-border); border-radius:10px;
  padding:11px 12px; margin:0 2px 8px; background:var(--app-surface-2);
  transition:border-color .12s, opacity .12s;
}
.ap-item:hover { border-color:var(--accent); }
.ap-item.off { opacity:.4; }
.ap-check { margin-top:2px; width:15px; height:15px; accent-color:var(--accent); flex-shrink:0; cursor:pointer; }
.ap-item-b { flex:1; min-width:0; }
.ap-item-h { display:flex; align-items:center; gap:9px; margin-bottom:6px; }
.ap-item-t { font-weight:700; font-size:12.5px; }
.ap-item-m { font-size:11px; color:var(--text-dim); }
.ap-item-c { font-size:12.5px; line-height:1.5; }
.ap-item-tags { font-size:11.5px; color:var(--accent-2); margin-top:4px; }

/* O sua caption ngay trong ban duyet Autopilot. Truoc day caption chi doc,
   khach thay cau nao khong vua y thi chi con cach bo ca bai. */
.ap-edit {
  width: 100%; margin-top: 6px; padding: 8px 10px;
  font: inherit; font-size: 12.5px; line-height: 1.5;
  color: var(--text); background: var(--bg-2, rgba(255,255,255,.03));
  border: 1px solid var(--border); border-radius: 9px;
  resize: vertical;
}
.ap-edit:focus { outline: none; border-color: var(--accent-2); }
.ap-edit-tg { font-size: 11.5px; color: var(--accent-2); }
.ap-edit-l {
  display: block; margin-top: 8px;
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-dim);
}
.ap-edit-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 8px;
}
.ap-count { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ap-count.ap-over { color: #f87171; font-weight: 700; }

.ap-approve-bar {
  position:sticky; bottom:0; display:flex; align-items:center; justify-content:space-between;
  gap:12px; margin-top:12px; padding:12px; border-radius:11px;
  background:var(--app-surface); border:1px solid var(--app-border);
}
.ap-approve-n { font-size:12.5px; color:var(--text-dim); }
.ap-approve-n b { color:var(--text); font-size:14px; }

.ap-done {
  background:var(--green-bg); color:var(--green); border:1px solid rgba(52,211,153,.3);
  border-radius:10px; padding:13px 15px; font-size:13px; font-weight:600; line-height:1.55;
}

/* ===== Hop thoai dung chung ===== */
.modal-back {
  display:none; position:fixed; inset:0; z-index:200;
  background:rgba(3,4,12,.72); backdrop-filter:blur(3px);
  align-items:flex-start; justify-content:center; padding:48px 16px; overflow-y:auto;
}
.modal-box {
  width:100%; max-width:480px; background:var(--app-surface);
  border:1px solid var(--app-border); border-radius:15px;
  box-shadow:0 24px 64px rgba(0,0,0,.5);
}
.modal-head {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:16px 18px; border-bottom:1px solid var(--app-border);
}
.modal-head h3 { margin:0; font-size:15px; font-weight:800; letter-spacing:-.015em; }
.modal-x {
  background:none; border:none; color:var(--text-dim); cursor:pointer;
  font-size:15px; padding:4px 8px; border-radius:7px; line-height:1;
}
.modal-x:hover { color:var(--text); background:var(--app-surface-2); }
.modal-body { padding:18px; }
.modal-body .field { margin-bottom:13px; }
.m-input {
  width:100%; padding:9px 11px; border-radius:9px; font-size:13px; font-family:inherit;
  background:var(--app-surface-2); border:1px solid var(--app-border); color:var(--text);
}
.m-input:focus { outline:none; border-color:var(--accent); }

/* The ket noi: che do dan token thu cong */
.connect-card-btn.manual { border-style:dashed; }
.connect-card-btn.manual .cc-note { color:var(--amber, #fbbf24); }

/* ===== Start here — dat tay nguoi moi ===== */
.onboard {
  background: linear-gradient(135deg, rgba(124,92,255,.10), rgba(34,211,238,.05));
  border: 1px solid rgba(124,92,255,.28); border-radius: 15px;
  padding: 18px 20px; margin-bottom: 20px;
}
.onboard-head { display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom:14px; }
.onboard-title { font-weight:800; font-size:15px; letter-spacing:-.01em; }
.onboard-sub { font-size:12.5px; color:var(--text-dim); margin-top:3px; }
.onboard-ring {
  width:52px; height:52px; border-radius:50%; flex-shrink:0;
  background:var(--accent-grad, linear-gradient(135deg,#7c5cff,#22d3ee));
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:12.5px; color:#fff;
  box-shadow:0 6px 18px -6px rgba(124,92,255,.6);
}
.onboard-steps { display:grid; gap:8px; }
.onboard-step {
  display:flex; align-items:center; gap:12px;
  background:var(--app-surface); border:1px solid var(--app-border);
  border-radius:11px; padding:11px 13px;
}
.onboard-step.done { opacity:.55; }
.onboard-n {
  width:26px; height:26px; border-radius:8px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:12.5px;
  background:rgba(124,92,255,.16); color:var(--accent-2);
}
.onboard-step.done .onboard-n { background:rgba(52,211,153,.15); color:var(--green); }
.onboard-step.optional .onboard-n { background:transparent; color:var(--text-dimmer); border:1px dashed var(--app-border); }
.onboard-b { flex:1; min-width:0; }
.onboard-t { font-weight:700; font-size:13px; }
.onboard-t em { font-style:normal; font-size:10.5px; color:var(--text-dimmer); font-weight:600; margin-left:5px; }
.onboard-d { font-size:12px; color:var(--text-dim); margin-top:1px; }
@media (max-width:640px){ .onboard-step { flex-wrap:wrap; } }

/* ===== Khung dien thoai xem truoc bai dang ===== */
.phone-frame { width: 270px; margin: 0 auto; background: #0a0c14; border: 3px solid #2a2f45;
  border-radius: 30px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.55); }
.phone-notch { width: 90px; height: 16px; margin: 8px auto 4px; background: #1c2033; border-radius: 10px; }
.phone-appbar { color: #fff; font: 700 12px/1 Inter, sans-serif; padding: 8px 12px; }
.phone-video { position: relative; height: 150px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #171b2c 0%, #232948 100%); color: rgba(255,255,255,.75); font-size: 30px; }
.phone-video-t { position: absolute; bottom: 8px; left: 10px; right: 10px; font: 600 10.5px/1.3 Inter, sans-serif;
  color: rgba(255,255,255,.85); text-shadow: 0 1px 5px rgba(0,0,0,.7); }
.phone-body { padding: 10px 12px 14px; }
.phone-acc { display: flex; align-items: center; gap: 7px; font: 600 11.5px/1 Inter, sans-serif; color: #e8eaf2; margin-bottom: 7px; }
.phone-ava { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-grad, #6366f1);
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 800; }
.phone-yt-title { font: 700 12px/1.35 Inter, sans-serif; color: #fff; margin-bottom: 5px; }
.phone-cap { font: 400 11.5px/1.5 Inter, sans-serif; color: #cfd3e4; white-space: pre-wrap; word-break: break-word;
  max-height: 130px; overflow-y: auto; }
.phone-tags { font: 500 11px/1.5 Inter, sans-serif; color: #7aa7ff; margin-top: 5px; word-break: break-word; }
.phone-meta { font: 500 10px/1 Inter, sans-serif; color: #6b7089; margin-top: 9px; }

/* ===== Posts-per-day grid (dung lai style dai chon ngay) ===== */
.ppd-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

/* ===== Chip "+ Connect" cho nen tang chua ket noi ===== */
.pf-chip-off { opacity: .78; border-style: dashed !important; }
.pf-chip-off:hover { opacity: 1; border-color: rgba(120,150,255,.6) !important; }
@media (max-width: 480px) { .ppd-grid { gap: 5px; } }

/* ===== Connected accounts phan cum theo nen tang ===== */
.acct-cluster { margin-bottom: 26px; }
.acct-cluster-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--app-border-soft); }
.acct-cluster-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0; }
.acct-cluster-icon svg { width: 19px; height: 19px; fill: #fff; }
.acct-cluster-name { font-size: 15px; font-weight: 800; color: var(--text); }
.acct-cluster-count { font-size: 12px; font-weight: 700; color: var(--text-dim); background: var(--app-surface-3);
  border: 1px solid var(--app-border); padding: 1px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.acct-cluster-hint { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.acct-cluster-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
/* Mau nen icon cum theo thuong hieu */
.acct-cluster-icon.c-youtube { background: var(--yt); }
.acct-cluster-icon.c-facebook { background: var(--fb); }
.acct-cluster-icon.c-instagram { background: var(--ig-grad); }
.acct-cluster-icon.c-tiktok { background: var(--tt-grad); }
.acct-cluster-icon.c-x { background: var(--x-bg); }
@media (max-width: 640px) { .acct-cluster-cards { grid-template-columns: 1fr; } }

/* ===== Magic Post: bo chon video (tabs + upload) ===== */
.media-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.media-tab { flex: 1; min-width: 120px; background: var(--app-surface-2); border: 1px solid var(--app-border);
  color: var(--text-dim); border-radius: 10px; padding: 9px 8px; font: 600 12.5px/1 Inter, sans-serif;
  cursor: pointer; transition: all .14s; }
.media-tab:hover { color: var(--text); border-color: #2e3554; }
.media-tab.on { background: var(--accent-grad); color: #fff; border-color: transparent; }
.up-bar { height: 8px; border-radius: 99px; background: var(--app-surface-3); overflow: hidden; border: 1px solid var(--app-border-soft); }
.up-bar-fill { height: 100%; background: var(--accent-grad); width: 0; transition: width .2s; border-radius: 99px; }
@media (max-width: 480px) { .media-tab { min-width: 0; font-size: 11.5px; padding: 8px 4px; } }

/* ===== Analytics ===== */
.an-chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.an-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.an-bar-fill { width: 100%; min-height: 2px; background: var(--accent-grad); border-radius: 3px 3px 0 0; transition: height .3s; }
.an-track { height: 8px; border-radius: 99px; background: var(--app-surface-3); overflow: hidden; }
.an-track-fill { height: 100%; border-radius: 99px; min-width: 3px; }

/* ===== Calendar ===== */
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-dow span { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; padding-left: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
/* min-width:0 phai co o MOI CAP cua chuoi, khong chi cap trong cung.
   .cal-cell la grid item; .cal-posts va .cal-post la flex item. Ca ba deu mac
   dinh min-width:auto, tuc deu tu no khong co nho hon noi dung. Chi can mot
   cap thieu la ca chuoi phinh ra va text-overflow o cap duoi cung vo tac dung
   — dung nhu vua thay: bo cat cung 22 ky tu ra thi chu tran han khoi o.       */
.cal-cell { min-height: 108px; min-width: 0; background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; }
.cal-empty { background: transparent; border: none; }
.cal-cell.cal-today { border-color: var(--accent, #7c5cff); box-shadow: 0 0 0 1px var(--accent, #7c5cff) inset; }
.cal-cell.cal-over { border-color: var(--accent-2, #60a5fa); background: rgba(96,165,250,.08); }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 4px; }
.cal-cell.cal-today .cal-daynum { color: var(--accent-2, #7aa7ff); }
.cal-posts { display: flex; flex-direction: column; gap: 3px; overflow: hidden; min-width: 0; }
/* overflow:hidden o day la CAN, khong thua: no la cai neo de text-overflow
   cua .cal-post-t co cho ma cat. */
.cal-post { display: flex; align-items: center; gap: 5px; background: var(--app-surface-3); border-radius: 6px; padding: 3px 6px; font-size: 11px; cursor: grab; overflow: hidden; }
.cal-post.posted { opacity: .55; }
.cal-post.failed { background: rgba(248,113,113,.15); }
.cal-post.dragging { opacity: .4; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
/* min-width:0 la thu lam cho ba dong duoi no co tac dung.
   Flex item mac dinh la min-width:auto — no KHONG co nho hon noi dung, nen
   the tieu de tran ra khoi o thay vi tu cat, va text-overflow khong bao gio
   duoc kich hoat. Ket qua: chu bi cha cat cung giua tu ("Publishing pipeline
   ch") thay vi co dau ba cham. Loi flexbox kinh dien, va no lam bang lich
   trong nhu hong. */
.cal-post-t { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cal-more { font-size: 10.5px; color: var(--text-dim); padding-left: 4px; }
@media (max-width: 700px) { .cal-cell { min-height: 76px; } .cal-post-t { display: none; } .cal-post { padding: 4px; } }

/* ===== Approvals board (Trello) ===== */
.appr-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.appr-col { background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 12px; padding: 12px; min-height: 300px; }
.appr-col.appr-over { border-color: var(--accent-2, #60a5fa); background: rgba(96,165,250,.06); }
.appr-col-h { font-size: 13px; font-weight: 800; margin-bottom: 12px; }
.appr-col-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.appr-card { background: var(--app-surface-3); border: 1px solid var(--app-border); border-radius: 10px; padding: 10px; cursor: grab; }
.appr-card:hover { border-color: #2e3554; }
@media (max-width: 720px) { .appr-board { grid-template-columns: 1fr; } }
.appr-drop-hint { border: 1.5px dashed var(--app-border); border-radius: 10px; padding: 18px 10px;
  text-align: center; font-size: 12px; color: var(--text-dimmer, #6b7080); }

/* ===== Ads Manager ===== */
select.inp { background: var(--app-surface-3); border: 1px solid var(--app-border); color: var(--app-text, #e8eaf2);
  border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13.5px; }
select.inp:focus { outline: none; border-color: #6366f1; }
.ads-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.ads-stat { background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 12px; padding: 15px 18px; }
.ads-stat .l { font-size: 12px; color: var(--text-dim, #8b90a6); margin-bottom: 6px; }
.ads-stat .n { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.ads-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.ads-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim, #8b90a6); }
.ads-table td { font-size: 13px; padding: 12px 10px; vertical-align: middle; }
.ads-obj { font-size: 10.5px; color: var(--text-dimmer, #6b7080); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.ads-good { color: #34d399; font-weight: 700; } .ads-bad { color: #f87171; font-weight: 700; }
.ads-pill { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.ads-pill.on { background: rgba(52,211,153,.15); color: #34d399; } .ads-pill.off { background: var(--app-surface-3); color: var(--text-dim, #8b90a6); }
.ads-sugbox { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ads-sug-sum { padding: 12px 14px; border-radius: 10px; font-size: 14px; background: rgba(99,102,241,.08); border: 1px solid rgba(99,102,241,.25); }
.ads-sug { border: 1px solid var(--app-border-soft); border-left-width: 3px; border-radius: 10px; padding: 11px 14px; background: var(--app-surface-2); }
.ads-sug.ads-scale { border-left-color: #34d399; } .ads-sug.ads-pause { border-left-color: #f87171; }
.ads-sug.ads-watch { border-left-color: #fbbf24; } .ads-sug.ads-fix { border-left-color: #22d3ee; }
.ads-sug-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ads-sug-tag { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--app-surface-3); text-transform: uppercase; letter-spacing: .03em; }
.ads-scale .ads-sug-tag { color: #34d399; } .ads-pause .ads-sug-tag { color: #f87171; }
.ads-watch .ads-sug-tag { color: #fbbf24; } .ads-fix .ads-sug-tag { color: #22d3ee; }
.ads-sug-reason { font-size: 13px; color: var(--text, #e8eaf2); }
.ads-sug-next { font-size: 12.5px; color: var(--accent-2, #7aa7ff); margin-top: 3px; }
.ads-stat.ads-alert { border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.06); }
.ads-stat.ads-alert .n { color: #f87171; }
.ads-stat-d { font-size: 11px; color: var(--text-dim, #8b90a6); margin-top: 3px; }
.ads-health-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.ads-health-item { display: flex; align-items: center; gap: 11px; background: var(--app-surface-2);
  border: 1px solid var(--app-border-soft); border-radius: 10px; padding: 11px 14px; }
.ads-hdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ads-hdot.on { background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,.6); }
.ads-hdot.off { background: #f87171; box-shadow: 0 0 8px rgba(248,113,113,.6); }
.ads-hinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ads-hinfo b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ads-hinfo span { font-size: 11.5px; color: var(--text-dim, #8b90a6); }
.ads-hspent { font-size: 12.5px; color: var(--text-dim, #8b90a6); white-space: nowrap; }
.ads-cap { display: inline-flex; align-items: center; gap: 7px; background: var(--app-surface-3);
  border: 1px solid var(--app-border); border-radius: 10px; padding: 4px 4px 4px 11px; }
.ads-cap span { font-size: 12px; color: var(--text-dim, #8b90a6); white-space: nowrap; }
.ads-cap input { width: 90px; background: transparent; border: none; color: var(--app-text, #e8eaf2);
  font: inherit; font-size: 13px; outline: none; }
.ads-new-panel { background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.ads-new-row { display: grid; grid-template-columns: 1.4fr 1.6fr 1fr .8fr; gap: 12px; }
.ads-new-row label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim, #8b90a6); }
.ads-new-row .inp { width: 100%; }
.ads-new-row input.inp { background: var(--app-surface-3); border: 1px solid var(--app-border); color: var(--app-text, #e8eaf2); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 13.5px; }
.ads-new-row input.inp:focus { outline: none; border-color: #6366f1; }
.ads-new-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 720px) { .ads-new-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .ads-summary { grid-template-columns: 1fr; } }

/* ===== Google Reviews ===== */
.rv-list { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.rv-item { background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 12px; padding: 14px 16px; }
.rv-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.rv-top b { font-size: 13.5px; }
.rv-stars { color: #fbbf24; font-size: 14px; letter-spacing: 1px; }
.rv-stars.low { color: #f87171; }
.rv-reply-wrap { margin-top: 8px; }
.rv-reply-in { width: 100%; min-height: 62px; background: var(--app-surface-3); border: 1px solid var(--app-border);
  color: var(--app-text, #e8eaf2); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 13.5px; resize: vertical; }
.rv-reply-in:focus { outline: none; border-color: #6366f1; }
.rv-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ===== Trending ===== */
.tr-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tr-bar .inp { background: var(--app-surface-3); border: 1px solid var(--app-border); color: var(--app-text, #e8eaf2);
  border-radius: 10px; padding: 11px 13px; font-size: 14px; font-family: inherit; }
.tr-bar .inp:focus { outline: none; border-color: #6366f1; }
.tr-plats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tr-pchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--app-border); background: var(--app-surface-2); cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-dim, #8b90a6); user-select: none; }
.tr-pchip svg { width: 15px; height: 15px; fill: currentColor; }
.tr-pchip.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, #6366f1, #22d3ee); }
.tr-note { color: var(--text-dim, #8b90a6); font-size: 12px; margin: 12px 0 0; line-height: 1.5; }
.tr-summary { margin: 16px 0 4px; padding: 14px 16px; border-radius: 12px; font-size: 14.5px; line-height: 1.5;
  background: rgba(99,102,241,.08); border: 1px solid rgba(99,102,241,.25); }
.tr-result { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 14px; }
.tr-card { background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 14px; padding: 16px; }
.tr-card-h { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.tr-card-h svg { width: 18px; height: 18px; }
.tr-sec { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim, #8b90a6); margin: 12px 0 6px; }
.tr-tags { display: flex; align-items: flex-start; gap: 8px; }
.tr-tags code { flex: 1; font-size: 13px; line-height: 1.6; color: #7aa7ff; word-break: break-word; font-family: inherit; }
.tr-copy { flex: none; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--app-border); background: var(--app-surface-3); color: var(--app-text, #e8eaf2); }
.tr-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.65; }
.tr-list li { margin-bottom: 3px; }
.tr-empty { grid-column: 1 / -1; text-align: center; padding: 48px 20px; display: flex;
  flex-direction: column; align-items: center; gap: 6px; }
.tr-empty-i { font-size: 34px; margin-bottom: 4px; opacity: .9; }
.tr-empty b { font-size: 15px; }
.tr-empty span { color: var(--text-dim, #8b90a6); font-size: 13.5px; max-width: 420px; line-height: 1.5; }

/* ===== Live per-platform preview ===== */
.pv-status { border-radius: 10px; padding: 10px 13px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.pv-status.pv-done { background: var(--green-bg, rgba(52,211,153,.12)); color: var(--green, #34d399); border: 1px solid rgba(52,211,153,.3); }
.pv-status.pv-prev { background: rgba(34,211,238,.1); color: var(--accent-2, #22d3ee); border: 1px solid rgba(34,211,238,.3); }
/* Preview song: mo hon hai trang thai kia — day chua phai ket qua that,
   khong duoc trong ngang mot ban caption da viet xong. */
.pv-status.pv-live {
  background: rgba(148,163,184,.09); color: var(--text-dim);
  border: 1px dashed var(--border);
}
.pv-toggle { display: inline-flex; gap: 4px; background: var(--app-surface-3); border: 1px solid var(--app-border); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.pv-tg { border: none; background: transparent; color: var(--text-dim, #8b90a6); font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.pv-tg.on { background: var(--app-surface); color: var(--app-text, #e8eaf2); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pv-card { background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 14px; overflow: hidden; border-top: 3px solid var(--pv-c, #6366f1); }
.pv-tiktok { --pv-c: #ff0050; } .pv-instagram { --pv-c: #e1306c; } .pv-youtube { --pv-c: #ff0000; }
.pv-facebook { --pv-c: #1877f2; } .pv-twitter { --pv-c: #1d9bf0; } .pv-linkedin { --pv-c: #0a66c2; } .pv-threads { --pv-c: #a855f7; }
.pv-head { display: flex; align-items: center; gap: 9px; padding: 11px 12px; }
.pv-av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--pv-c), #22d3ee);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #fff; flex: none; }
.pv-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pv-who b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-who span { font-size: 11px; color: var(--text-dim, #8b90a6); }
.pv-badge { flex: none; width: 22px; height: 22px; color: var(--pv-c); }
.pv-badge svg { width: 22px; height: 22px; fill: currentColor; }
.pv-cap-top { padding: 0 12px 10px; } .pv-cap-bot { padding: 10px 12px 0; }
.pv-cap { font-size: 13px; line-height: 1.5; }
.pv-title { font-size: 13.5px; font-weight: 700; line-height: 1.4; }
.pv-tags { color: var(--accent-2, #7aa7ff); }
.pv-more { color: var(--text-dim, #8b90a6); }
.pv-media { background-size: cover; background-position: center; background-color: #0d1018;
  position: relative; display: flex; align-items: center; justify-content: center; }
.pv-tall { aspect-ratio: 9 / 16; } .pv-wide { aspect-ratio: 16 / 9; } .pv-feed { aspect-ratio: 4 / 5; }
.pv-ph { background: linear-gradient(135deg, #14182a, #1d2236); }
.pv-play { width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.85); }
.pv-play::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-40%, -50%);
  border-left: 15px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.pv-imgicon { font-size: 30px; opacity: .5; }
.pv-acts { display: flex; align-items: center; gap: 14px; padding: 10px 12px; color: var(--text-dim, #8b90a6); }
.pv-acts svg { width: 18px; height: 18px; }
.pv-time { margin-left: auto; font-size: 11px; }
.pv-count { padding: 0 12px 11px; font-size: 11px; }
.pv-count.pv-ok { color: var(--text-dimmer, #6b7080); }
.pv-count.pv-over { color: #f87171; font-weight: 700; }
@media (max-width: 560px) { .pv-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .pv-grid { grid-template-columns: 1fr; } }

/* ===== Inbox (unified comments) ===== */
.nav-badge { background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 800;
  border-radius: 999px; padding: 1px 6px; margin-left: auto; }
.ib-filters { display: flex; gap: 6px; margin-bottom: 16px; }
.ib-fbtn { border: 1px solid var(--app-border); background: var(--app-surface-2); color: var(--text-dim, #8b90a6);
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.ib-fbtn.on { background: linear-gradient(135deg, #6366f1, #22d3ee); color: #fff; border-color: transparent; }
.ib-list { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.ib-item { background: var(--app-surface-2); border: 1px solid var(--app-border-soft); border-radius: 12px; padding: 14px 16px; }
.ib-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ib-top b { font-size: 13.5px; }
.ib-meta { font-size: 11.5px; color: var(--text-dim, #8b90a6); }
.ib-tag { margin-left: auto; font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.ib-tag.ib-new { background: rgba(239,68,68,.15); color: #f87171; }
.ib-tag.ib-rep { background: rgba(52,211,153,.15); color: #34d399; }
.ib-tag.ib-done { background: var(--app-surface-3); color: var(--text-dim, #8b90a6); }
.ib-text { font-size: 14px; line-height: 1.55; margin-bottom: 8px; word-break: break-word; }
.ib-yourreply { font-size: 13px; color: var(--accent-2, #7aa7ff); background: rgba(99,102,241,.08);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.ib-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ib-reply-in { flex: 1; min-width: 160px; background: var(--app-surface-3); border: 1px solid var(--app-border);
  color: var(--app-text, #e8eaf2); border-radius: 9px; padding: 9px 12px; font: inherit; font-size: 13.5px; }
.ib-reply-in:focus { outline: none; border-color: #6366f1; }
.ib-empty { text-align: center; padding: 54px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ib-empty-i { font-size: 34px; margin-bottom: 4px; }
.ib-empty b { font-size: 15px; }
.ib-empty span { color: var(--text-dim, #8b90a6); font-size: 13.5px; max-width: 440px; line-height: 1.5; }

/* ==================== AUTOPILOT: chan som, gom gon, nut luon thay ==================== */

/* Kho rong thi Autopilot khong the lam gi — noi thang o dau man, kem loi ra */
.ap-block {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; margin-bottom: 18px;
  border: 1px solid rgba(251, 191, 36, .35);
  background: rgba(251, 191, 36, .07);
  border-radius: 14px;
}
.ap-block-i { font-size: 26px; line-height: 1; flex-shrink: 0; }
.ap-block-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ap-block-t b { font-size: 14px; }
.ap-block-t span { font-size: 13px; color: var(--text-dim); line-height: 1.55; }
@media (max-width: 620px) {
  .ap-block { flex-wrap: wrap; }
  .ap-block .btn { width: 100%; justify-content: center; }
}

/* 23 chu de la qua nhieu cho mot o tuy chon: mac dinh chi cao 2 hang */
.ap-cats-collapsed { max-height: 84px; overflow: hidden; }
.ap-cats-more {
  margin-top: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--accent-2);
}
.ap-cats-more:hover { text-decoration: underline; }

/* Hanh dong chinh khong duoc nam duoi day man hinh */
.ap-cta {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px;
  position: sticky; bottom: 0; z-index: 2;
  padding: 12px 0 4px;
  background: linear-gradient(to top, var(--surface) 62%, transparent);
}

/* ==================== THU VIEN: tai hang loat ==================== */
.lib-bulk-list { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.lbi {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 7px 2px; font-size: 12.8px; border-bottom: 1px solid var(--app-border-soft);
}
.lbi:last-child { border-bottom: 0; }
.lbi-n { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbi-s { flex-shrink: 0; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-dimmer); }
.lbi-s.run { color: var(--accent-2); }
.lbi-s.ok  { color: #34d399; }
.lbi-s.bad { color: #f87171; }

/* ==================== CHI TIET MOT BAI DANG ==================== */
.hist-row { cursor: pointer; }
.hist-row:hover { background: var(--app-hover, rgba(255,255,255,.03)); }

.pd-scrim {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,.62); backdrop-filter: blur(3px);
}
.pd-scrim.show { display: flex; }
.pd-panel {
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--app-border-soft);
  border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.85);
}
.pd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--app-border-soft);
  position: sticky; top: 0; background: var(--surface); border-radius: 18px 18px 0 0;
}
.pd-head h4 { margin: 0; font-size: 15px; font-weight: 700; }
.pd-x { background: none; border: 0; color: var(--text-dim); font-size: 16px; cursor: pointer; padding: 4px 8px; }
.pd-x:hover { color: var(--text); }
.pd-body { padding: 18px 20px 22px; }
.pd-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.pd-media { width: 100%; border-radius: 12px; margin-bottom: 14px; background: #000; max-height: 46vh; object-fit: contain; }
.pd-nomedia {
  padding: 22px 16px; text-align: center; font-size: 12.8px; color: var(--text-dimmer);
  border: 1px dashed var(--app-border-soft); border-radius: 12px; margin-bottom: 14px;
}
.pd-cap { font-size: 13.6px; line-height: 1.65; white-space: pre-wrap; margin-bottom: 14px; }
.pd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 0; border-top: 1px solid var(--app-border-soft); font-size: 13px;
}
.pd-row span { color: var(--text-dim); }
.pd-err {
  margin-top: 12px; padding: 11px 14px; border-radius: 10px; font-size: 12.6px; line-height: 1.55;
  color: #fca5a5; background: rgba(248,113,113,.09); border: 1px solid rgba(248,113,113,.28);
  word-break: break-word;
}

/* ==================== CANH BAO DUNG LUONG (moi man) ==================== */
.st-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 0 -4px; padding: 11px 22px;
  font-size: 13px; line-height: 1.5;
  border-bottom: 1px solid rgba(251, 191, 36, .3);
  background: rgba(251, 191, 36, .09); color: var(--text);
}
.st-banner.full {
  border-bottom-color: rgba(248, 113, 113, .35);
  background: rgba(248, 113, 113, .1);
}
.st-banner .btn { flex-shrink: 0; background: rgba(255,255,255,.08); color: var(--text); }
.st-banner .btn:hover { background: rgba(255,255,255,.14); }
@media (max-width: 620px) { .st-banner { flex-wrap: wrap; } }

/* ==================== CANH BAO DANG TRUNG NEN TANG ==================== */
.dup-warn {
  margin-top: 10px; padding: 12px 15px; border-radius: 11px;
  font-size: 12.8px; line-height: 1.6;
  border: 1px solid rgba(251, 191, 36, .32);
  background: rgba(251, 191, 36, .07);
}
.dup-warn b { display: block; margin-bottom: 3px; }
.dup-warn i { font-style: italic; opacity: .9; }
.dup-tip {
  display: block; margin-top: 7px; padding-top: 7px;
  border-top: 1px solid rgba(251, 191, 36, .2);
  color: var(--text-dim);
}

/* Anh dat vao nen tang chi nhan video -> bai CHAC CHAN hong, khong phai
   "co the kem". Nen do chu khong vang, de phan biet voi canh bao trung bai. */
.fit-warn {
  margin-top: 10px; padding: 12px 15px; border-radius: 11px;
  font-size: 12.8px; line-height: 1.6;
  border: 1px solid rgba(248, 113, 113, .38);
  background: rgba(248, 113, 113, .08);
}
.fit-warn b { display: block; margin-bottom: 3px; }
.fit-warn .dup-tip { border-top-color: rgba(248, 113, 113, .22); }

.pv-empty {
  padding: 26px 18px; text-align: center;
  font-size: 12.5px; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: 12px;
}

/* ==================== ADS MANAGER — nang cap ==================== */
.ads-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; padding: 0 0 16px;
}
.ads-kpi {
  padding: 14px 16px; border-radius: 13px;
  border: 1px solid var(--app-border-soft); background: var(--surface-2);
}
.ads-kpi .l { font-size: 11.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-dimmer); }
.ads-kpi .n { font-size: 23px; font-weight: 800; margin-top: 5px;
  font-variant-numeric: tabular-nums; }
.ads-kpi .s { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* Chon khoang thoi gian */
.ads-range { display: inline-flex; gap: 3px; padding: 3px;
  border-radius: 10px; background: var(--surface-2); }
.ads-rbtn {
  border: 0; background: none; cursor: pointer; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--text-dim); padding: 6px 12px; border-radius: 8px;
}
.ads-rbtn.on { background: var(--surface-3); color: var(--text); }
.ads-rbtn:hover:not(.on) { color: var(--text); }

/* Bang: cot so canh phai de so sanh theo cot, dau bang thang hang */
.ads-table td.r, .ads-table th.r { text-align: right; }
.ads-table td.r { font-variant-numeric: tabular-nums; }
.ads-th { cursor: pointer; user-select: none; white-space: nowrap; }
.ads-th:hover { color: var(--text); }
.ads-th.on { color: var(--accent-2); }
.ads-per { font-size: 11px; color: var(--text-dimmer); margin-left: 3px; }
.ads-flag { margin-left: 6px; color: #fbbf24; cursor: help; }

/* ===== Bang dieu khien tai san quang cao (gom theo Business Manager) ===== */
.ads-bm { border: 1px solid var(--app-border, #232741); border-radius: 14px;
          margin-bottom: 14px; overflow: hidden; background: var(--app-surface-2, #171a28); }
.ads-bm-h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
            padding: 12px 14px; background: var(--app-surface-3, #1e2233);
            border-bottom: 1px solid var(--app-border, #232741); }
.ads-bm-none { background: rgba(251,191,36,.06); }
.ads-bm-t { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ads-bm-t b { font-size: 14px; }
.ads-bm-ic { font-size: 15px; }
.ads-bm-m { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px;
            color: var(--text-dim, #9aa0c0); margin-left: auto; }
.ads-bm-bad { color: #f87171; font-weight: 700; }
.ads-bm-warn { color: #fbbf24; }
.ads-bm-a { display: flex; gap: 6px; }
.ads-bm-list { display: flex; flex-direction: column; }

/* ID bam-de-chep: dan chay ads doi chieu ID lien tuc, go tay la sai */
.ads-id { display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
          background: var(--app-surface, #11131f); border: 1px solid var(--app-border, #232741);
          border-radius: 7px; padding: 2px 7px; font-size: 11px; color: var(--text-dim, #9aa0c0); }
.ads-id:hover { border-color: var(--accent, #7c5cff); color: var(--text, #f0f2fc); }
.ads-id code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.ads-id-l { font-weight: 800; opacity: .65; font-size: 9.5px; letter-spacing: .04em; }

.ads-acc { border-bottom: 1px solid var(--app-border-soft, #1a1d30); padding: 10px 14px; }
.ads-acc:last-child { border-bottom: 0; }
.ads-acc-main { display: flex; align-items: center; gap: 10px; }
.ads-acc-id { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ads-acc-id b { font-size: 13px; }
.ads-acc-main .ads-hspent { margin-left: auto; white-space: nowrap; }
.ads-more { background: none; border: 0; color: var(--text-dim, #9aa0c0); cursor: pointer;
            font-size: 16px; padding: 2px 6px; border-radius: 6px; line-height: 1; }
.ads-more:hover { background: var(--app-surface-3, #1e2233); color: var(--text, #f0f2fc); }
.ads-acc-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 5px; margin-left: 19px;
                font-size: 11px; color: var(--text-dimmer, #6b7194); }

.ads-acc-panel { margin: 10px 0 2px 19px; padding: 12px; border-radius: 10px;
                 background: var(--app-surface, #11131f); border: 1px solid var(--app-border, #232741); }
.ads-kvs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 18px; }
.ads-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px;
          padding: 4px 0; border-bottom: 1px dashed var(--app-border-soft, #1a1d30); }
.ads-kv span { color: var(--text-dim, #9aa0c0); }
.ads-kv b { text-align: right; word-break: break-word; }
.ads-dim { color: var(--text-dimmer, #6b7194); font-weight: 500; }
.ads-kv-h { font-size: 11px; font-weight: 800; color: var(--text-dim, #9aa0c0);
            margin: 12px 0 6px; letter-spacing: .03em; }
.ads-users { margin-top: 4px; }
.ads-user { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 3px 0; }
.ads-user span { color: var(--text-dim, #9aa0c0); font-size: 11px; }
.ads-acts { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.ads-note { font-size: 11px; color: var(--text-dim, #9aa0c0); margin: 9px 0 0; line-height: 1.5; }
.ads-loading { font-size: 12px; color: var(--text-dim, #9aa0c0); padding: 6px 0; }
.ads-form { margin-top: 10px; }
.ads-form-r { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.ads-form-r .inp { flex: 1; min-width: 160px; font-size: 12px; padding: 6px 9px; }
.btn-xs { font-size: 11.5px; padding: 5px 10px; }

@media (max-width: 720px) {
  .ads-bm-m { margin-left: 0; width: 100%; }
  .ads-acc-main { flex-wrap: wrap; }
  .ads-acc-main .ads-hspent { margin-left: 19px; }
  .ads-kvs { grid-template-columns: 1fr; }
}
.ads-mini { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px;
            color: var(--text-dimmer, #6b7194); background: var(--app-surface-3, #1e2233);
            padding: 1px 5px; border-radius: 5px; margin-left: 5px; }
.ads-rm { background: none; border: 1px solid var(--app-border, #232741); border-radius: 6px;
          color: var(--text-dim, #9aa0c0); font-size: 10.5px; padding: 3px 8px; cursor: pointer; }
.ads-rm:hover { border-color: #f87171; color: #f87171; }
.ads-rm-go:hover { border-color: var(--accent, #7c5cff); color: var(--accent, #7c5cff); }

/* ===== Lo tao nhieu ad account ===== */
.ads-batches { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.bt-row { border: 1px solid var(--app-border, #232741); border-radius: 12px;
          padding: 11px 13px; background: var(--app-surface-2, #171a28); }
.bt-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.bt-bm { font-size: 11px; color: var(--text-dim, #9aa0c0); }
.bt-a { margin-left: auto; display: flex; gap: 6px; }
.bt-bar { height: 5px; border-radius: 999px; background: var(--app-surface-3, #1e2233);
          margin-top: 9px; overflow: hidden; }
.bt-bar i { display: block; height: 100%; background: var(--accent-grad, #7c5cff);
            transition: width .4s ease; }
.bt-n { font-size: 11px; color: var(--text-dim, #9aa0c0); margin-top: 7px; line-height: 1.5; }
.bt-stop { color: #fbbf24; }
.bt-eta { font-size: 12px; color: var(--text-dim, #9aa0c0); margin: 4px 0 2px; }
.bt-jit { font-size: 11px; opacity: .75; display: inline-block; margin-top: 3px; }

/* ===== Quet bang mat: mau noi trang thai, khong bat doc chu ===== */
/* Vien trai la thu mat bat duoc truoc nhat khi luot doc mot cot dai. */
.ads-bm.sk-ok   { border-left: 3px solid rgba(52,211,153,.55); }
.ads-bm.sk-warn { border-left: 3px solid rgba(251,191,36,.65); }
.ads-bm.sk-bad  { border-left: 3px solid rgba(248,113,113,.65); }
.ads-acc.sk-bad { background: rgba(248,113,113,.045); }
.ads-acc.sk-bad .ads-acc-id b { color: #fca5a5; }

/* Gia tri trong bang chi tiet — chi to mau khi CO Y NGHIA, khong to het */
.ads-kv b.v-ok   { color: #34d399; }
.ads-kv b.v-warn { color: #fbbf24; }
.ads-kv b.v-dim  { color: var(--text-dimmer, #6b7194); font-weight: 500; }

/* Dong meta: icon lam moc neo cho mat, chu van la thu doc */
.ads-acc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ads-acc-meta .m-ok   { color: #34d399; }
.ads-acc-meta .m-warn { color: #fbbf24; font-weight: 600; }

/* The tong quan: xanh khi lanh, do khi can chu y */
.ads-stat.s-ok .n { color: #34d399; }
.ads-stat.ads-alert .n { color: #f87171; }
.ads-summary { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Chrome tu dien vao o tim kiem.
   Day la o input[type=text] DAU TIEN tren trang, nen trinh quan ly mat khau
   cua Chrome nham vao no va dien mot muc da luu — mot chuoi hex 32 ky tu, boi
   xanh san. Chrome BO QUA autocomplete="off" cho viec nay; doi sang
   type="search" moi that su ngan duoc.
   Hai dong duoi la lop bao hiem: neu Chrome van dien, it nhat o khong bi to
   xanh choi loi giua giao dien toi. */
#global-search:-webkit-autofill,
#global-search:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text, #f0f2fc);
  box-shadow: 0 0 0 1000px var(--app-surface-2, #171a28) inset;
  transition: background-color 9999s ease-out;
}

/* Xem truoc video: khung hinh dau lam anh dai dien.
   Video an cho den khi co du lieu (onloadeddata), de trong luc tai khong hien
   mot o den nhap nhay — o giu nguyen nen placeholder roi hien ra mot lan. */
.pv-media.pv-vid { position: relative; overflow: hidden; background: var(--app-surface-3, #1e2233); }
.pv-media.pv-vid video {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .25s ease;
}
.pv-media.pv-vid.co-hinh video { opacity: 1; }

/* Huy hieu "1/5" khi co nhieu anh — khach phai biet con anh nua */
.pv-count-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.72); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  letter-spacing: .02em;
}
.pv-media { position: relative; }

/* ===== Chon nhieu tai khoan ===== */
.ads-tick { width: 15px; height: 15px; accent-color: var(--accent, #7c5cff); cursor: pointer; flex: none; }
.ads-bulkbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; z-index: 60;
  background: var(--app-surface-2, #171a28);
  border: 1px solid var(--accent, #7c5cff);
  border-radius: 999px; padding: 8px 14px;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.85);
}
.ads-bulkbar b { font-size: 12.5px; margin-right: 4px; white-space: nowrap; }
@media (max-width: 720px) {
  .ads-bulkbar { flex-wrap: wrap; justify-content: center; width: calc(100% - 24px); border-radius: 14px; }
}
/* Khung hinh that trong xem truoc Autopilot — bo padding cua o placeholder cu */
.phone-video.phone-video-real { padding: 0; display: block; background: none; }
.phone-video.phone-video-real .pv-media { border-radius: 0; height: 100%; }
.pd-edit-l { display: block; font-size: 11.5px; font-weight: 700; color: var(--text-dim, #9aa0c0); margin: 12px 0 0; }
.pd-edit-l .inp { margin-top: 5px; width: 100%; }
.pd-hint { font-weight: 400; color: var(--text-dim, #9aa0c0); font-size: 11px; margin-left: 6px; text-transform: none; }
.pd-edit-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }

/* Nguon caption: AI hay thu vien mau. O lai tren man hinh, khong phai toast. */
.pv-src { font-size: 12px; color: var(--text-dim, #9aa0c0); padding: 8px 12px;
          border-radius: 9px; background: rgba(255,255,255,.04); margin-bottom: 10px; }
.pv-src b { color: var(--text, #e8ebff); font-weight: 700; }
.pv-src-warn { color: #fbbf24; background: rgba(251,191,36,.10);
               border: 1px solid rgba(251,191,36,.28); line-height: 1.5; }
.pv-src-warn b { color: #fbbf24; }
