/* TokMatrix Admin — bổ sung nhỏ trên nền AdminLTE 4 */
:root { --bs-body-font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { background: var(--bs-tertiary-bg); }

.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-right: .5rem;
  border-radius: 8px; background: var(--bs-primary); color: #fff; font-size: 1rem; vertical-align: middle;
}
.sidebar-menu .nav-header { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; opacity: .7; padding-top: 1rem; }
.sidebar-menu .nav-link p { display: flex; align-items: center; gap: .4rem; width: 100%; min-width: 0; margin-bottom: 0; }
.sidebar-menu .nav-badge { margin-left: auto; font-size: .68rem; flex-shrink: 0; }

.app-content-header h3 { font-weight: 600; }
.card-title { font-weight: 600; }

/* bảng */
.table th { white-space: nowrap; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: var(--bs-secondary-color); }
.dt-sortable { cursor: pointer; user-select: none; }
.dt-sortable::after { content: "\F127"; font-family: "bootstrap-icons"; opacity: .25; margin-left: .25rem; font-size: .7rem; }
.dt-asc::after { content: "\F148"; opacity: .8; }
.dt-desc::after { content: "\F128"; opacity: .8; }
.table td .btn-group-sm > .btn, .table td .btn-sm { --bs-btn-padding-y: .18rem; --bs-btn-padding-x: .42rem; white-space: nowrap; }
.tm-row-actions { flex-wrap: nowrap; white-space: nowrap; }
.cell-sub { display: block; font-size: .78rem; color: var(--bs-secondary-color); line-height: 1.3; margin-top: 1px; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

/* nhật ký */
.log-box {
  max-height: 420px; overflow: auto; margin: 0; padding: .75rem; border-radius: .375rem;
  background: #0d1117; color: #c9d1d9; font: .8rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word;
}

/* lưới thẻ media */
.media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.media-card { overflow: hidden; }
.media-card .media-thumb { aspect-ratio: 9 / 16; background: var(--bs-secondary-bg) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--bs-secondary-color); }
.media-card .media-thumb.square { aspect-ratio: 1 / 1; }
.media-card .card-body { padding: .6rem .75rem; }

.small-box h3 { font-size: 1.9rem; }
.kv dt { font-weight: 600; color: var(--bs-secondary-color); font-size: .85rem; }
.kv dd { margin-bottom: .5rem; word-break: break-word; }

@media (max-width: 575.98px) {
  .app-content-header .breadcrumb { display: none; }
  .small-box h3 { font-size: 1.5rem; }
}

/* ---------- Lịch đăng ---------- */
.up-step { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-bottom: .75rem; }
.up-step > span { display: inline-flex; width: 1.6rem; height: 1.6rem; border-radius: 50%; align-items: center; justify-content: center; background: var(--bs-primary); color: #fff; font-size: .85rem; }
.up-lib { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 330px; overflow: auto; padding: 2px; }
.up-lib-item { display: flex; flex-direction: column; text-align: left; padding: .35rem; border: 2px solid var(--bs-border-color); border-radius: .5rem; background: var(--bs-body-bg); }
.up-lib-item.on { border-color: var(--bs-primary); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .2); }
.up-lib-thumb { aspect-ratio: 9/16; border-radius: .35rem; background: var(--bs-secondary-bg) center/cover; display: flex; align-items: center; justify-content: center; margin-bottom: .3rem; color: var(--bs-secondary-color); }
.up-lib-title { font-size: .78rem; font-weight: 600; line-height: 1.2; }
.up-chips { display: flex; flex-wrap: wrap; gap: .4rem; max-height: 220px; overflow: auto; }
.up-chip { border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); border-radius: 999px; padding: .2rem .7rem; font-size: .82rem; }
.up-chip small { margin-left: .35rem; color: var(--bs-secondary-color); }
.up-chip.on { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.up-chip.on small { color: rgba(255,255,255,.75); }
.up-golden.active { background: var(--bs-primary); color: #fff; border-color: var(--bs-primary); }
.up-phone { position: sticky; top: 1rem; width: 280px; margin: 0 auto; aspect-ratio: 9/18.5; border: 10px solid #111; border-radius: 34px; background: #000; overflow: hidden; color: #fff; }
.up-phone-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.up-phone-screen video, .up-phone-screen img { width: 100%; height: 100%; object-fit: cover; }
.up-phone-overlay { position: absolute; left: .75rem; right: 3.5rem; bottom: 1rem; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.up-phone-actions { position: absolute; right: .6rem; bottom: 4rem; display: flex; flex-direction: column; gap: 1rem; font-size: 1.4rem; }
.up-group-head { cursor: pointer; user-select: none; }
.up-card .up-media { position: relative; aspect-ratio: 4/3; background: var(--bs-secondary-bg); cursor: pointer; overflow: hidden; border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; display: flex; align-items: center; justify-content: center; }
.up-card .up-media img { width: 100%; height: 100%; object-fit: cover; }
.up-card .up-play { position: absolute; font-size: 2.2rem; color: rgba(255,255,255,.9); text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.up-card .up-media-top { position: absolute; top: .35rem; left: .35rem; right: .35rem; display: flex; justify-content: space-between; gap: .25rem; }
.up-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.up-cal-head { text-align: center; font-weight: 600; font-size: .8rem; color: var(--bs-secondary-color); padding: .25rem 0; }
.up-cal-cell { min-height: 108px; border: 1px solid var(--bs-border-color); border-radius: .4rem; padding: .3rem; font-size: .75rem; overflow: hidden; }
.up-cal-cell.other { background: var(--bs-tertiary-bg); border-style: dashed; }
.up-cal-cell.today { border-color: var(--bs-primary); box-shadow: inset 0 0 0 1px var(--bs-primary); }
.up-cal-cell.has { cursor: pointer; }
.up-cal-cell.has:hover { background: var(--bs-secondary-bg); }
.up-cal-date { font-weight: 700; }
.up-ev { border-radius: .25rem; padding: 0 .3rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; }
@media (max-width: 767.98px) { .up-cal-cell { min-height: 64px; } .up-ev { display: none; } }

/* ---------- Mạng & VPN ---------- */
.vpn-hero { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-radius: .75rem; color: #fff;
  background: linear-gradient(135deg, #0b1f3a 0%, #134e8a 60%, #0ea5e9 100%); box-shadow: 0 6px 20px rgba(14, 165, 233, .2); }
.vpn-country-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: 420px; overflow: auto; padding: 2px; }
.vpn-country { border: 1px solid var(--bs-border-color); border-radius: .6rem; padding: .7rem; cursor: pointer; transition: border-color .15s, box-shadow .15s; background: var(--bs-body-bg); }
.vpn-country:hover { border-color: var(--bs-primary); }
.vpn-country.active { border-color: var(--bs-primary); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .2); }
.vpn-load { display: inline-block; border-radius: 999px; padding: .1rem .55rem; font-size: .78rem; }

/* ---------- Video Studio ---------- */
.st-bar-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); min-width: 5.5rem; }
.st-search { max-width: 340px; flex: 1 1 220px; }
.st-lib { position: sticky; top: .5rem; display: flex; flex-direction: column; height: calc(100vh - 6rem); }
.st-list { overflow: auto; flex: 1; min-height: 0; }
.st-item { display: flex; gap: .8rem; padding: .65rem .85rem; border-bottom: 1px solid var(--bs-border-color); color: inherit; text-decoration: none; }
.st-item:hover { background: var(--bs-tertiary-bg); }
.st-item.active { background: rgba(var(--bs-primary-rgb), .1); box-shadow: inset 4px 0 0 var(--bs-primary); }
.st-item img { width: 72px; height: 128px; object-fit: cover; border-radius: .5rem; background: var(--bs-secondary-bg); flex: none; }
.st-poster-empty { width: 72px; height: 128px; border-radius: .5rem; background: var(--bs-secondary-bg); display: flex; align-items: center; justify-content: center; font-size: 1.55rem; flex: none; user-select: none; }
.st-item-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: .98rem; line-height: 1.3; margin-bottom: .2rem; }
.st-item-meta { font-size: .82rem; color: var(--bs-secondary-color); line-height: 1.45; }
.min-w-0 { min-width: 0; }
.st-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.st-chip { border: 1px solid var(--bs-border-color); border-radius: 999px; padding: .1rem .55rem; font-size: .76rem; color: inherit; text-decoration: none; white-space: nowrap; }
.st-chip b { color: var(--bs-secondary-color); font-weight: 600; margin-left: .15rem; }
.st-chip.on { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.st-chip.on b { color: rgba(255,255,255,.8); }
.st-pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; background: var(--bs-secondary-bg); }
.st-pill.ok { background: rgba(var(--bs-success-rgb), .15); color: var(--bs-success-text-emphasis); }
.st-phone { width: 300px; max-width: 100%; aspect-ratio: 9/16; background: #000; border: 8px solid #111; border-radius: 28px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.st-phone video, .st-phone iframe { width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
.st-beat-img { width: 100%; height: 72px; object-fit: cover; border-radius: .35rem; background: var(--bs-secondary-bg); }
.st-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .4rem; max-height: 360px; overflow: auto; }
.st-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .35rem; cursor: pointer; border: 3px solid transparent; }
.st-gallery img.on { border-color: var(--bs-primary); }
@media (max-width: 991.98px) { .st-lib { position: static; height: auto; max-height: 70vh; } .st-bar-label { min-width: 0; } }
.st-template { border: 1px dashed var(--bs-border-color); border-radius: .5rem; align-items: center; }

/* ---------- Trạng thái tải ---------- */
#top-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
#top-progress::before { content: ""; position: absolute; inset: 0; width: 40%; background: var(--bs-primary); animation: tp-slide 1.1s ease-in-out infinite; }
#top-progress.on { opacity: 1; }
@keyframes tp-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.skeleton { display: block; height: .85rem; border-radius: .25rem; width: 80%;
  background: linear-gradient(90deg, var(--bs-secondary-bg) 25%, var(--bs-tertiary-bg) 50%, var(--bs-secondary-bg) 75%); background-size: 200% 100%; animation: sk-shine 1.2s linear infinite; }
.skeleton-row td:first-child .skeleton { width: 55%; }
.skeleton-row td:last-child .skeleton { width: 40%; margin-left: auto; }
@keyframes sk-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
#page.page-leaving { opacity: .45; pointer-events: none; transition: opacity .15s; }
#page { transition: opacity .15s; }
.page-spinner { min-height: 40vh; display: flex; align-items: center; justify-content: center; }
.card { position: relative; }
.card > .overlay { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(var(--bs-body-bg-rgb), .7); border-radius: inherit; }
.btn .btn-spin { margin-right: .35rem; vertical-align: -.125em; }
@media (prefers-reduced-motion: reduce) { #top-progress::before, .skeleton { animation: none; } }

/* ---------- Rà soát bố cục ---------- */
.small-box .inner { padding-right: 5.5rem; }
.small-box-sub { font-size: .8rem; opacity: .85; min-height: 1.2em; }
#page .nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
#page .nav-tabs .nav-link { white-space: nowrap; }
.wk-table { table-layout: fixed; }
.wk-table td { overflow: hidden; text-overflow: ellipsis; }
.table-responsive > .table > thead th { position: sticky; top: 0; background: var(--bs-body-bg); z-index: 1; }
.card-header .card-tools { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.card-header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.card-header .card-title { margin-right: auto; }
.card-header::after { display: none; }
.info-box { min-height: 72px; }
.info-box .info-box-number { font-size: 1.15rem; }
.info-box .info-box-text { white-space: normal; line-height: 1.2; }
.media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 767.98px) {
  .small-box .inner { padding-right: 1rem; }
  .small-box .small-box-icon { display: none; }
  .small-box h3 { font-size: 1.6rem; }
  .info-box { padding: .5rem; }
  .info-box .info-box-icon { width: 48px; font-size: 1.3rem; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .app-content-header h3 { font-size: 1.35rem; }
}

/* ---------- Bố cục SaaS Pro & Quản trị Kênh ---------- */
.card {
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .02);
  border-color: var(--bs-border-color-translucent);
}
.card-header {
  background: transparent;
  padding: .85rem 1.1rem;
  border-bottom-color: var(--bs-border-color-translucent);
}
.tm-kpi-card {
  border-radius: .75rem;
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  padding: .65rem .85rem;
  margin-bottom: .85rem;
}
.tm-kpi-card[role="button"] { cursor: pointer; }
.tm-kpi-card[role="button"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .07);
}
.tm-kpi-card.tm-kpi-active {
  border-width: 2px;
  box-shadow: 0 4px 14px rgba(var(--bs-primary-rgb), .14);
}
.tm-kpi-card .info-box-icon {
  width: 52px; height: 52px; border-radius: .65rem; font-size: 1.35rem;
}
.tm-kpi-card .info-box-number {
  font-size: 1.25rem; font-weight: 700; line-height: 1.2; margin-top: .1rem;
}
.tm-kpi-sub {
  display: block; font-size: .75rem; color: var(--bs-secondary-color); margin-top: .15rem;
}

/* Segmented Tabs & Quick Country Strip */
.tm-seg-tabs {
  display: flex; flex-wrap: nowrap; overflow-x: auto; gap: .35rem;
  padding: .35rem; border-radius: .7rem;
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color-translucent);
}
.tm-seg-tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .85rem; border-radius: .5rem;
  font-size: .86rem; font-weight: 600; white-space: nowrap;
  color: var(--bs-secondary-color); text-decoration: none;
  border: 1px solid transparent; transition: all .15s ease;
}
.tm-seg-tab:hover { color: var(--bs-body-color); background: rgba(var(--bs-body-bg-rgb), .5); }
.tm-seg-tab.active {
  color: var(--bs-body-color);
  background: var(--bs-body-bg);
  border-color: var(--bs-border-color-translucent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.tm-country-strip {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
}
.tm-country-pill {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .18rem .6rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg); color: var(--bs-body-color);
  cursor: pointer; transition: all .12s ease; text-decoration: none;
}
.tm-country-pill:hover { border-color: var(--bs-primary); }
.tm-country-pill.active {
  background: var(--bs-primary); border-color: var(--bs-primary); color: #fff;
}

/* Bulk Action Bar */
.tm-bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .6rem 1rem; margin-bottom: .75rem; border-radius: .65rem;
  background: linear-gradient(90deg, rgba(var(--bs-primary-rgb), .12), rgba(var(--bs-info-rgb), .08));
  border: 1px solid rgba(var(--bs-primary-rgb), .35);
}

/* Channel Avatar, Health Score, Video Streak & BKT Progress */
.tm-ch-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.tm-streak {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: middle;
}
.tm-streak-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.tm-streak-dot.clean { background: #10b981; box-shadow: 0 0 0 1px rgba(16,185,129,.3); }
.tm-streak-dot.sb { background: #ef4444; box-shadow: 0 0 0 1px rgba(239,68,68,.35); }
.tm-streak-dot.dup { background: #f59e0b; }
.tm-streak-dot.flop { background: #dc2626; opacity: .75; }
.tm-streak-dot.unknown { background: #94a3b8; opacity: .5; }
.tm-score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: .1rem .38rem; border-radius: .35rem;
  font-size: .72rem; font-weight: 700;
}
.tm-bkt-box { min-width: 118px; }
.tm-bkt-progress {
  height: 5px; border-radius: 999px; background: var(--bs-secondary-bg); overflow: hidden; margin-top: 3px;
}
.tm-bkt-progress > div { height: 100%; border-radius: 999px; }
.tm-table tbody tr { transition: background-color .1s ease; }
.tm-table td { padding-top: .5rem; padding-bottom: .5rem; }

