:root,
[data-theme="light"] {
  color-scheme: light;
  --page-bg: #f1f5f9;
  --bg: #f1f5f9;
  --bg-elevated: #e2e8f0;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --fb: #1877f2;
  --fb-soft: #eff6ff;
  --tiktok: #fe2c55;
  --tiktok-soft: #fff1f3;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --input-bg: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.94);
  --nav-border: #e2e8f0;
  --brand-fg: #0f172a;
  --brand-sub: #64748b;
  --nav-link: #64748b;
  --nav-link-hover: #0f172a;
  --nav-link-hover-bg: #f1f5f9;
  --nav-link-active-fg: #0f172a;
  --nav-link-active-bg: #e2e8f0;
  --pill-bg: #f1f5f9;
  --pill-fg: #475569;
  --pill-border: #e2e8f0;
  --pill-ok-bg: #ecfdf5;
  --pill-ok-fg: #047857;
  --pill-ok-border: #a7f3d0;
  --pill-warn-bg: #fffbeb;
  --pill-warn-fg: #b45309;
  --pill-warn-border: #fde68a;
  --pill-stop-bg: #fef2f2;
  --pill-stop-fg: #b91c1c;
  --pill-stop-border: #fecaca;
  --chip-live-bg: #dbeafe;
  --chip-live-fg: #1d4ed8;
  --stat-scheduled: #7c3aed;
  --overlay: rgba(15, 23, 42, 0.45);
  --bar-bg: rgba(255, 255, 255, 0.97);
  --bar-shadow: 0 -8px 32px rgba(15, 23, 42, 0.1);
  --row-hover: #f8fafc;
  --on-accent: #ffffff;
  --success-text: #047857;
  --success-border: #a7f3d0;
  --danger-text: #991b1b;
  --danger-border: #fecaca;
  --warn-text: #b45309;
  --info-bg: #eef2ff;
  --info-text: #312e81;
  --info-border: #c7d2fe;
  --chip-info-bg: #e8f4fd;
  --chip-info-text: #1565a8;
  --chip-info-border: #b6d9f5;
  --sched-text: #047857;
  --sched-row-bg: rgba(34, 197, 94, 0.12);
  --sched-row-fg: #047857;
  --sched-preview-bg: rgba(34, 197, 94, 0.06);
  --sched-preview-border: rgba(34, 197, 94, 0.25);
  --featured-border: #a7f3d0;
  --vps-bg: #f1f5f9;
  --vps-border: #e2e8f0;
  --vps-fg: #475569;
  --vps-warn: #d97706;
  --vps-crit: #dc2626;
  --footer-text: #64748b;
  --err-inline: #b91c1c;
  --badge-pending-bg: #fef3c7;
  --badge-pending-fg: #92400e;
  --badge-scheduled-bg: #ede9fe;
  --badge-scheduled-fg: #5b21b6;
  --badge-processing-bg: #dbeafe;
  --badge-processing-fg: #1e40af;
  --badge-publishing-bg: #e0e7ff;
  --badge-publishing-fg: #3730a3;
  --badge-published-bg: #d1fae5;
  --badge-published-fg: #065f46;
  --badge-failed-bg: #fee2e2;
  --badge-failed-fg: #991b1b;
  --job-scan-bg: rgba(59, 130, 246, 0.15);
  --job-scan-fg: #1d4ed8;
  --job-processing-bg: rgba(234, 179, 8, 0.15);
  --job-processing-fg: #b45309;
  --job-publishing-bg: rgba(168, 85, 247, 0.15);
  --job-publishing-fg: #6b21a8;
  --job-system-bg: rgba(220, 38, 38, 0.15);
  --job-system-fg: #b91c1c;
  --job-scheduled-bg: rgba(168, 85, 247, 0.12);
  --job-scheduled-fg: #5b21b6;
  --job-pending-bg: rgba(148, 163, 184, 0.2);
  --job-pending-fg: #475569;
  --job-failed-bg: rgba(220, 38, 38, 0.15);
  --job-failed-fg: #b91c1c;
  --fb-active-bg: rgba(24, 119, 242, 0.08);
  --focus-ring: rgba(79, 70, 229, 0.15);
  --hero-fg: #0f172a;
  --hero-sub: #64748b;
  --flow-fg: #64748b;
  --flow-bg: #f8fafc;
  --flow-border: #e2e8f0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --nav-h: 64px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #0b0f19;
  --bg: #0f1419;
  --bg-elevated: #111827;
  --surface: #1e293b;
  --surface-2: #151c28;
  --border: #334155;
  --border-strong: #475569;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --fb: #60a5fa;
  --fb-soft: rgba(24, 119, 242, 0.15);
  --tiktok-soft: rgba(254, 44, 85, 0.12);
  --success-soft: rgba(5, 150, 105, 0.18);
  --danger-soft: rgba(220, 38, 38, 0.18);
  --warn-soft: rgba(217, 119, 6, 0.18);
  --input-bg: #1e293b;
  --nav-bg: rgba(11, 15, 25, 0.94);
  --nav-border: rgba(255, 255, 255, 0.08);
  --brand-fg: #ffffff;
  --brand-sub: #94a3b8;
  --nav-link: #94a3b8;
  --nav-link-hover: #e2e8f0;
  --nav-link-hover-bg: rgba(255, 255, 255, 0.06);
  --nav-link-active-fg: #ffffff;
  --nav-link-active-bg: rgba(255, 255, 255, 0.1);
  --pill-bg: rgba(255, 255, 255, 0.06);
  --pill-fg: #cbd5e1;
  --pill-border: rgba(255, 255, 255, 0.08);
  --pill-ok-bg: rgba(5, 150, 105, 0.15);
  --pill-ok-fg: #6ee7b7;
  --pill-ok-border: rgba(5, 150, 105, 0.3);
  --pill-warn-bg: rgba(217, 119, 6, 0.15);
  --pill-warn-fg: #fcd34d;
  --pill-warn-border: rgba(217, 119, 6, 0.3);
  --pill-stop-bg: rgba(220, 38, 38, 0.2);
  --pill-stop-fg: #fca5a5;
  --pill-stop-border: rgba(220, 38, 38, 0.35);
  --chip-live-bg: rgba(59, 130, 246, 0.25);
  --chip-live-fg: #93c5fd;
  --stat-scheduled: #a78bfa;
  --overlay: rgba(0, 0, 0, 0.65);
  --bar-bg: rgba(30, 41, 59, 0.97);
  --bar-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  --row-hover: rgba(255, 255, 255, 0.04);
  --on-accent: #ffffff;
  --success-text: #6ee7b7;
  --success-border: rgba(5, 150, 105, 0.35);
  --danger-text: #fca5a5;
  --danger-border: rgba(220, 38, 38, 0.35);
  --warn-text: #fcd34d;
  --info-bg: rgba(99, 102, 241, 0.18);
  --info-text: #c7d2fe;
  --info-border: rgba(129, 140, 248, 0.35);
  --chip-info-bg: rgba(59, 130, 246, 0.18);
  --chip-info-text: #93c5fd;
  --chip-info-border: rgba(59, 130, 246, 0.35);
  --sched-text: #6ee7b7;
  --sched-row-bg: rgba(34, 197, 94, 0.15);
  --sched-row-fg: #6ee7b7;
  --sched-preview-bg: rgba(34, 197, 94, 0.1);
  --sched-preview-border: rgba(34, 197, 94, 0.28);
  --featured-border: rgba(5, 150, 105, 0.45);
  --vps-bg: rgba(255, 255, 255, 0.06);
  --vps-border: rgba(255, 255, 255, 0.1);
  --vps-fg: #cbd5e1;
  --vps-warn: #fcd34d;
  --vps-crit: #fca5a5;
  --footer-text: #94a3b8;
  --err-inline: #fca5a5;
  --badge-pending-bg: rgba(217, 119, 6, 0.2);
  --badge-pending-fg: #fcd34d;
  --badge-scheduled-bg: rgba(139, 92, 246, 0.22);
  --badge-scheduled-fg: #c4b5fd;
  --badge-processing-bg: rgba(59, 130, 246, 0.22);
  --badge-processing-fg: #93c5fd;
  --badge-publishing-bg: rgba(99, 102, 241, 0.22);
  --badge-publishing-fg: #a5b4fc;
  --badge-published-bg: rgba(5, 150, 105, 0.22);
  --badge-published-fg: #6ee7b7;
  --badge-failed-bg: rgba(220, 38, 38, 0.22);
  --badge-failed-fg: #fca5a5;
  --job-scan-bg: rgba(59, 130, 246, 0.22);
  --job-scan-fg: #93c5fd;
  --job-processing-bg: rgba(234, 179, 8, 0.2);
  --job-processing-fg: #fcd34d;
  --job-publishing-bg: rgba(168, 85, 247, 0.22);
  --job-publishing-fg: #d8b4fe;
  --job-system-bg: rgba(220, 38, 38, 0.22);
  --job-system-fg: #fca5a5;
  --job-scheduled-bg: rgba(168, 85, 247, 0.2);
  --job-scheduled-fg: #e9d5ff;
  --job-pending-bg: rgba(100, 116, 139, 0.28);
  --job-pending-fg: #cbd5e1;
  --job-failed-bg: rgba(220, 38, 38, 0.22);
  --job-failed-fg: #fca5a5;
  --fb-active-bg: rgba(96, 165, 250, 0.12);
  --focus-ring: rgba(129, 140, 248, 0.25);
  --hero-fg: #f1f5f9;
  --hero-sub: #94a3b8;
  --flow-fg: #94a3b8;
  --flow-bg: rgba(255, 255, 255, 0.06);
  --flow-border: rgba(255, 255, 255, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

[hidden] {
  display: none !important;
}

.alert-compact:empty {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

input,
textarea,
select {
  color: var(--text);
  background: var(--input-bg);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* —— Nav —— */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-border);
}

.topnav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--brand-fg);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.brand-text h1 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--brand-sub);
  font-weight: 500;
}

.topnav-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-fg);
  border: 1px solid var(--pill-border);
}

.nav-pill.ok {
  background: var(--pill-ok-bg);
  color: var(--pill-ok-fg);
  border-color: var(--pill-ok-border);
}

.nav-pill.warn {
  background: var(--pill-warn-bg);
  color: var(--pill-warn-fg);
  border-color: var(--pill-warn-border);
}

.nav-pill.stop {
  background: var(--pill-stop-bg);
  color: var(--pill-stop-fg);
  border-color: var(--pill-stop-border);
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  justify-content: center;
}

.topnav-link {
  color: var(--nav-link);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
}

.topnav-link:hover {
  color: var(--nav-link-hover);
  background: var(--nav-link-hover-bg);
}

.topnav-link.active {
  color: var(--nav-link-active-fg);
  background: var(--nav-link-active-bg);
}

.nav-count {
  font-size: 0.75rem;
  opacity: 0.85;
}

.nav-count-live {
  background: var(--chip-live-bg);
  color: var(--chip-live-fg);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-icon {
  display: none;
}

[data-theme="light"] .theme-icon-dark,
[data-theme="dark"] .theme-icon-light {
  display: inline;
}

.page-jobs {
  padding-bottom: 2rem;
}

.jobs-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.jobs-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.jobs-total {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

.jobs-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.muted-chip {
  opacity: 0.65;
}

.jobs-table-scroll {
  max-height: min(70vh, 640px);
  overflow: auto;
}

.badge.job-scan,
.badge.job-publish_worker {
  background: var(--job-scan-bg);
  color: var(--job-scan-fg);
}

.badge.job-processing {
  background: var(--job-processing-bg);
  color: var(--job-processing-fg);
}

.badge.job-publishing {
  background: var(--job-publishing-bg);
  color: var(--job-publishing-fg);
}

.badge.job-system {
  background: var(--job-system-bg);
  color: var(--job-system-fg);
}

.badge.job-scheduled {
  background: var(--job-scheduled-bg);
  color: var(--job-scheduled-fg);
}

.badge.job-pending {
  background: var(--job-pending-bg);
  color: var(--job-pending-fg);
}

.badge.job-failed {
  background: var(--job-failed-bg);
  color: var(--job-failed-fg);
}

.jobs-toolbar {
  margin: 0.5rem 0.85rem;
}

.jobs-pager {
  margin: 0 0.85rem 0.35rem;
}

.jobs-refresh-hint {
  margin-top: 0.5rem;
}

.vps-mini {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--vps-fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: var(--vps-bg);
  border: 1px solid var(--vps-border);
}

.vps-mini[hidden] {
  display: none !important;
}

.vps-chip {
  color: var(--vps-fg);
}

.vps-chip.warn {
  color: var(--vps-warn);
}

.vps-chip.crit {
  color: var(--vps-crit);
}

.vps-dot {
  opacity: 0.35;
}

@media (max-width: 900px) {
  .vps-mini {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
  }
}

.stat-link {
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.35rem;
}

.stat-link:hover {
  background: var(--success-soft);
}

.schedule-preview {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.55rem 1.5rem 0;
}

.publish-bar .schedule-preview {
  border-bottom: 1px solid var(--sched-preview-border);
  background: var(--sched-preview-bg);
}

.schedule-preview[hidden] {
  display: none !important;
}

.schedule-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.schedule-preview-sub {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.schedule-preview-table-wrap {
  max-height: 140px;
  overflow: auto;
}

.schedule-preview-table {
  width: 100%;
  font-size: 0.8125rem;
}

.schedule-preview-table th,
.schedule-preview-table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.publish-bar .schedule-preview-table .sched-time {
  font-weight: 700;
  color: var(--sched-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tr.row-scheduled-new td {
  background: var(--sched-row-bg);
}

tr.row-scheduled-new .time-cell {
  font-weight: 700;
  color: var(--sched-row-fg);
}

.vf-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.vf-modal[hidden] {
  display: none !important;
}

.vf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.vf-modal-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(85vh, 640px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-lg);
}

.vf-modal-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.vf-modal-summary {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vf-modal-table-wrap {
  max-height: 50vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.vf-modal-note {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.vf-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.vf-modal-table-wrap .sched-time {
  font-weight: 700;
  color: var(--sched-text);
  font-variant-numeric: tabular-nums;
}

.vid-pick-st {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: normal;
}

.queue-history-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-left: auto;
}

.queue-history-link:hover {
  text-decoration: underline;
}

.page-history-body {
  background: var(--bg);
}

.page-history {
  padding-bottom: 2rem;
}

.history-section {
  margin-top: 0.5rem;
}

.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.history-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.history-total {
  font-weight: 700;
  color: var(--success);
  font-size: 0.9375rem;
}

.history-table-scroll {
  max-height: calc(100vh - 240px);
  min-height: 320px;
}

.history-pager {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

/* —— Layout —— */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.hero-banner {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 1rem;
}

.hero-banner h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--hero-fg);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.hero-banner p {
  color: var(--hero-sub);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto;
}

.flow-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.flow-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--flow-fg);
  background: var(--flow-bg);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--flow-border);
}

.flow-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* —— Bảng điều khiển: toolbar gọn —— */
.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dash-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.metric-link:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.metric-val {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.metric-link .metric-val {
  color: var(--accent);
}

.metric-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

#stat-fanpages { color: var(--fb); }
#stat-pending { color: var(--accent); }
#stat-scheduled { color: var(--stat-scheduled); }
#stat-published { color: var(--success); }

.dash-fb {
  flex: 1;
  min-width: 12rem;
  max-width: 28rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dash-fb summary {
  list-style: none;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.dash-fb summary::-webkit-details-marker {
  display: none;
}

.fb-panel-body {
  padding: 0 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.fb-accounts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 9rem;
  overflow-y: auto;
}

.fb-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.fb-account-row.is-active {
  border-color: var(--fb);
  background: var(--fb-active-bg);
}

.fb-account-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.fb-account-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-account-fp {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.fb-account-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fb);
  white-space: nowrap;
}

.fb-account-select-form {
  margin: 0;
  flex-shrink: 0;
}

.fb-login-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fb-login-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
}

.btn-fb-login {
  width: 100%;
  background: var(--fb);
  color: var(--on-accent);
  border: none;
  text-align: center;
  text-decoration: none;
  justify-content: center;
}

.btn-fb-login:hover {
  filter: brightness(1.05);
  color: var(--on-accent);
}

.fb-login-alt {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.fb-app-secret-once {
  font-size: 0.8125rem;
}

.fb-app-secret-once summary {
  cursor: pointer;
  color: var(--warn-text);
}

.fb-token-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.fb-explorer-link {
  font-size: 0.75rem;
  color: var(--accent);
  flex: 1 1 100%;
}

.fb-token-form input {
  flex: 1 1 8rem;
  min-width: 0;
  font-size: 16px;
}

.fb-env-refresh {
  margin: 0;
  padding-top: 0.25rem;
}

.fb-meta-setup {
  font-size: 0.8125rem;
}

.fb-meta-setup summary {
  cursor: pointer;
  font-weight: 600;
}

.fb-meta-steps {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  line-height: 1.5;
}

.fb-meta-steps code {
  font-size: 0.72rem;
  word-break: break-all;
}

.legal-page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1rem;
  line-height: 1.6;
}

.legal-page h1 {
  font-size: 1.35rem;
}

.btn-fb-login-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
}

.fb-login-lead {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.fb-app-setup {
  font-size: 0.8125rem;
}

.fb-app-setup summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--warn-text);
}

.fb-app-secret-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.fb-app-secret-form input {
  width: 100%;
  font-size: 16px;
}

.fb-login-note {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.fb-login-note code {
  font-size: 0.68rem;
}

.fb-token-manual {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fb-token-manual summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.25rem 0;
}

.fb-manual-hint {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.fb-manual-hint a {
  color: var(--fb);
}

#fb-active-label {
  color: var(--fb);
  font-weight: 600;
}

.workspace-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace-inner {
  padding: 1rem 1.15rem;
}

.scan-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.scan-inline-main {
  flex: 1 1 16rem;
  min-width: min(100%, 16rem);
}

.cookies-setup {
  flex: 1 1 100%;
  padding: 0.65rem 0.75rem;
  background: var(--warn-soft);
  border: 1px solid var(--pill-warn-border);
  border-radius: var(--radius-sm);
}

.cookies-setup-hint {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.cookies-setup-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem;
}

.cookies-setup-form textarea {
  flex: 1 1 12rem;
  min-height: 2.5rem;
  font-size: 0.75rem;
}

.scan-row-warn {
  padding: 0.5rem;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
}

.cookies-fold summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}

.page-home .page > .alert-compact,
.page-home #live-alert {
  margin-bottom: 0.65rem;
}

.page-home #live-alert:not([hidden]) {
  display: block;
}

.publish-bar-inner {
  justify-content: space-between;
}

.btn-schedule {
  min-width: 8.5rem;
  font-weight: 600;
}

/* —— Hai dòng đầu trang (legacy) —— */
.top-two-lines {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.top-two-lines .line-1 {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.top-two-lines .line-1 > .stats-inline {
  align-self: flex-start;
  max-width: 100%;
}

.stats-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow);
}

.stats-inline b {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  margin-right: 0.1rem;
}

.stats-inline .stat-fb b { color: var(--fb); }
.stats-inline .stat-pending b { color: var(--accent); }
.stats-inline .stat-sched b { color: var(--stat-scheduled); }
.stats-inline .stat-done b { color: var(--success); }

.stats-inline .stat-sep {
  opacity: 0.35;
  user-select: none;
}

.line-2.line-fb {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.line-2.line-fb summary {
  list-style: none;
  cursor: pointer;
  padding: 0.42rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.line-2.line-fb summary::-webkit-details-marker {
  display: none;
}

.line-2.line-fb summary::after {
  content: " ▾";
  color: var(--text-muted);
  font-weight: 400;
}

.line-2.line-fb[open] summary::after {
  content: " ▴";
}

.fb-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.65rem 0.55rem;
  border-top: 1px solid var(--border);
}

.fb-inline input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
}

.alert-compact {
  padding: 0.5rem 0.75rem 0.5rem 2.15rem;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
}

.alert-body {
  display: block;
  min-width: 0;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.alert.info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.alert.info::before {
  content: "i";
  background: var(--accent);
  color: var(--on-accent);
}

.alert.warn {
  background: var(--warn-soft);
  color: var(--warn-text);
  border: 1px solid var(--pill-warn-border);
}

.alert.warn::before {
  content: "!";
  background: var(--warn);
  color: var(--on-accent);
}

.home-setup-banner a,
.home-queue-link a {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.alert-compact::before {
  position: absolute;
  left: 0.55rem;
  top: 0.55rem;
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
}

.top-two-lines .line-1 .home-queue-link {
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
}

/* —— Stats (legacy grid) —— */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card .label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-card:nth-child(1) .value { color: var(--fb); }
.stat-card:nth-child(2) .value { color: var(--accent); }
.stat-card:nth-child(3) .value { color: var(--stat-scheduled); }
.stat-card:nth-child(4) .value { color: var(--success); }

/* —— Alerts —— */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.alert::before {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
}

.alert.ok {
  background: var(--success-soft);
  color: var(--success-text);
  border-color: var(--success-border);
}

.alert.ok a.alert-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.alert.ok::before {
  content: "✓";
  background: var(--success);
  color: var(--on-accent);
}

.alert.bad {
  background: var(--danger-soft);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.alert.bad::before {
  content: "!";
  background: var(--danger);
  color: var(--on-accent);
}

/* —— Steps —— */
.workflow {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.step-card.featured {
  border-color: var(--featured-border);
  box-shadow: 0 0 0 1px var(--featured-border), var(--shadow);
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}

.step-badge {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--on-accent);
}

.step-card[data-step="1"] .step-badge {
  background: linear-gradient(135deg, #1877f2, #0d65d9);
}

.step-card[data-step="2"] .step-badge {
  background: linear-gradient(135deg, #fe2c55, #ff0050);
}

.step-card[data-step="3"] .step-badge {
  background: linear-gradient(135deg, #059669, #10b981);
}

.step-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.step-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.step-body {
  padding: 1.35rem 1.5rem;
}

.step-body + .step-body {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.sub-block {
  margin-bottom: 1.25rem;
}

.sub-block:last-child {
  margin-bottom: 0;
}

.sub-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.65rem;
}

.sub-label .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tiktok);
}

/* —— Forms —— */
.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  line-height: 1.5;
}

.field-hint strong {
  color: var(--text-secondary);
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.file-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  background: var(--input-bg);
  margin-bottom: 0.75rem;
  transition: border-color 0.15s, background 0.15s;
}

.file-zone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-zone input[type="file"] {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.cookies-panel {
  background: var(--warn-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.25rem;
  margin-bottom: 0;
}

.cookies-panel .field {
  margin-bottom: 0.75rem;
}

.cookies-panel .field:last-of-type {
  margin-bottom: 0;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: var(--on-accent);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.btn-success:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}

.btn-warning:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-block {
  width: 100%;
  padding: 0.95rem 1.5rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.status-chip.ok {
  background: var(--success-soft);
  color: var(--success-text);
}

.status-chip.warn {
  background: var(--warn-soft);
  color: var(--warn-text);
}

.status-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* —— Publish CTA —— */
.publish-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.publish-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  background: var(--success-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--success-border);
}

.publish-meta div {
  font-size: 0.875rem;
}

.publish-meta strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--success-text);
  letter-spacing: -0.02em;
}

.fanpage-picker {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.check-all-row {
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.fanpage-grid {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.25rem;
}

.video-picker {
  margin-bottom: 1rem;
}

.video-grid {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.video-item-text {
  line-height: 1.4;
  word-break: break-word;
}

.video-item-text em {
  font-style: normal;
  font-weight: 600;
  color: var(--tiktok);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  transition: background 0.12s;
}

.check-row:hover {
  background: var(--accent-soft);
}

.check-row input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  flex-shrink: 0;
  margin: 0;
}

.fanpage-item span {
  line-height: 1.35;
  word-break: break-word;
}

.cookies-compact {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0 !important;
  border-bottom: 1px solid var(--border);
}

.cookies-update {
  font-size: 0.875rem;
}

.cookies-update summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  list-style: none;
}

.cookies-update summary::-webkit-details-marker {
  display: none;
}

.cookies-panel-inner {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--warn-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
}

.cookies-panel-inner input[type="file"],
.cookies-panel-inner textarea {
  margin-bottom: 0.65rem;
}

.publish-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn-outline {
  background: var(--surface);
  color: var(--success);
  border: 2px solid var(--success);
  box-shadow: none;
}

.btn-outline:hover:not(:disabled) {
  background: var(--success-soft);
}

.field-inline {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.field-inline label {
  font-size: 0.8rem;
}

.input-sm {
  max-width: 120px;
  margin-bottom: 0;
}

.btn-danger {
  background: var(--danger);
  color: var(--on-accent);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.08);
}

.stop-row {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.inline-form {
  display: inline;
}

/* —— Table —— */
.data-section {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-section-head {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.data-section-head h3 {
  font-size: 1rem;
  font-weight: 700;
}

.data-section-head span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.queue-delete-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.queue-select-all {
  margin: 0;
  font-size: 0.875rem;
}

.queue-del-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1 1 100%;
  order: 10;
}

.queue-del-hint a {
  color: var(--accent);
  text-decoration: none;
}

.queue-del-hint a:hover {
  text-decoration: underline;
}

.col-check {
  width: 2.5rem;
  text-align: center;
  padding-left: 1rem !important;
  padding-right: 0.5rem !important;
}

.col-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
}

.status-chip.info {
  background: var(--chip-info-bg);
  color: var(--chip-info-text);
  border: 1px solid var(--chip-info-border);
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem !important;
}

.row-err {
  font-size: 0.75rem;
  color: var(--err-inline);
  margin-top: 0.35rem;
  line-height: 1.35;
  max-width: 320px;
  word-break: break-word;
}

.status-cell {
  vertical-align: top;
}

.schedule-advanced {
  margin-top: 0;
  padding-top: 0.5rem;
}

.schedule-advanced summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.schedule-inline-form {
  margin-top: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--surface-2);
}

th {
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover td {
  background: var(--row-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

.channel-tag {
  font-weight: 600;
  color: var(--text);
  font-size: 0.8125rem;
}

.video-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  max-width: 320px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-link:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.pending { background: var(--badge-pending-bg); color: var(--badge-pending-fg); }
.badge.scheduled { background: var(--badge-scheduled-bg); color: var(--badge-scheduled-fg); }
.badge.processing { background: var(--badge-processing-bg); color: var(--badge-processing-fg); }
.badge.publishing { background: var(--badge-publishing-bg); color: var(--badge-publishing-fg); }
.badge.published { background: var(--badge-published-bg); color: var(--badge-published-fg); }
.badge.failed { background: var(--badge-failed-bg); color: var(--badge-failed-fg); }

.platform-cell {
  font-size: 0.8125rem;
  max-width: 11rem;
}

.platform-tag {
  display: inline-block;
  font-weight: 600;
  color: var(--fb);
  font-size: 0.75rem;
}

.fanpage-name {
  color: var(--text-secondary);
  margin-top: 0.15rem;
  line-height: 1.3;
  word-break: break-word;
}

.col-action {
  width: 7.5rem;
  text-align: center;
}

.btn-view-post {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.time-cell {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.sched-same {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* —— Footer —— */
.site-footer {
  max-width: 1120px;
  margin: 2rem auto 0;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--footer-text);
}

/* —— Overlay —— */
.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

.scan-overlay[hidden] {
  display: none !important;
}

html.vf-loading-active {
  overflow: hidden;
}

html.vf-scan-active .page-home .workspace-panel,
html.vf-scan-active .page-home .dash-toolbar {
  filter: blur(2px);
  user-select: none;
}

html.vf-loading-active body {
  pointer-events: none;
}

#vf-loading-overlay {
  pointer-events: all;
  cursor: wait;
}

.scan-overlay-box {
  background: var(--surface);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  text-align: center;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}

.scan-overlay-box strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.scan-overlay-box .vf-loading-sub {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
}

.scan-overlay-box .muted {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.scan-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.25rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* —— Workspace 2 cột —— */
.workspace-card .step-header {
  border-bottom: 1px solid var(--border);
}

.workspace-compact {
  padding: 0.65rem 0.75rem 0.75rem;
}

.picker-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.picker-duo .picker-panel {
  margin-top: 0;
}

@media (max-width: 720px) {
  .picker-duo {
    grid-template-columns: 1fr;
  }
}

.line-scan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  margin: 0 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.scan-inline {
  display: flex;
  flex: 1;
  min-width: 12rem;
  gap: 0.4rem;
  align-items: center;
}

.scan-inline textarea {
  flex: 1;
  min-width: 0;
  min-height: 2rem;
  max-height: 4.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  resize: vertical;
}

.scan-inline input[type="text"],
.scan-inline input[type="number"] {
  min-width: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
}

.scan-inline input[type="text"] {
  flex: 1;
}

.cookies-update-inline {
  font-size: 0.75rem;
}

.cookies-update-inline summary {
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem 0.35rem;
}

.scan-status-line {
  display: block;
  margin: 0 0 0.45rem;
}

.scan-platform-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.scan-platform-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.scan-platform-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.scan-platform-btn:hover {
  border-color: var(--accent);
}

.scan-platform-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.scan-platform-hint {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.compact-queue .queue-head-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.compact-queue .queue-head-line strong {
  font-weight: 700;
}

.compact-queue .queue-select-all {
  margin: 0;
  font-size: 0.8125rem;
}

.ui-hidden {
  display: none !important;
}

.home-queue-link {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.home-queue-link a {
  color: var(--accent);
  font-weight: 600;
}

.publish-bar-jobs-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.publish-bar-jobs-link:hover {
  text-decoration: underline;
}

.publish-bar-setup .publish-bar-meta {
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.page-jobs .jobs-queue-section {
  margin-top: 0.5rem;
}

.page-jobs .jobs-publish-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
}

.jobs-queue-controls {
  margin: 0.5rem 0.85rem 0;
}

.workspace-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
}

.workspace-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1.25rem 1.35rem;
}

.pane-tiktok {
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.pane-fanpage {
  background: var(--surface-2);
}

.pane-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.pane-cookies,
.pane-cookies-form {
  margin-bottom: 0.75rem;
}

.pane-cookies-form input[type="file"],
.pane-cookies-form textarea {
  margin-bottom: 0.5rem;
  width: 100%;
}

.pane-scan {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.pane-scan .field {
  margin-bottom: 0.65rem;
}

.pane-video-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.pane-list-head {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
}

.pane-video-list .video-grid {
  flex: 1;
  max-height: none;
  min-height: 120px;
}

.pane-empty-hint {
  padding: 1rem;
  text-align: center;
  margin: 0;
}

.pane-fp-hint {
  margin: -0.35rem 0 0.75rem;
}

.pane-fp-picker {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.pane-fp-grid {
  flex: 1;
  max-height: none;
  grid-template-columns: 1fr;
}

.schedule-cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.schedule-cta-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.schedule-cta-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.schedule-cta-text strong {
  font-size: 1rem;
  color: var(--text);
}

.schedule-cta-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.schedule-cta-arrow {
  font-size: 1.35rem;
  color: var(--accent);
  font-weight: 700;
}

.page-schedule .page {
  max-width: 1100px;
}

.schedule-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.85rem;
}

.schedule-page-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.schedule-head-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.schedule-workspace {
  margin-top: 0;
}

.schedule-picker-duo {
  margin-top: 0;
}

.picker-panel-static {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.picker-panel-static .picker-head {
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.schedule-picker-scroll {
  max-height: min(52vh, 420px);
}

.picker-empty-hint {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.picker-empty-hint a {
  color: var(--accent);
  font-weight: 600;
}

.schedule-video-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

@media (max-width: 720px) {
  .schedule-page-head {
    flex-direction: column;
  }
}

/* Danh sách thu gọn + cuộn + phân trang */
.picker-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-top: 0.65rem;
}

.picker-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.picker-panel summary::-webkit-details-marker {
  display: none;
}

.picker-panel summary::after {
  content: " ▾";
  color: var(--text-muted);
  font-weight: 400;
}

.picker-panel[open] summary::after {
  content: " ▴";
}

.picker-body {
  border-top: 1px solid var(--border);
  padding: 0;
}

.picker-scroll {
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
}

.picker-scroll.fanpage-grid,
.picker-scroll.video-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  max-height: 260px;
}

.picker-scroll .check-row {
  border-radius: 0;
  margin: 0;
}

.picker-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.queue-table-scroll {
  max-height: 320px;
}

.queue-pager {
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* —— Thanh đăng bài cuối trang —— */
.page {
  padding-bottom: 6rem;
}

.page > .alert-compact:not(#live-alert) {
  margin-bottom: 0.5rem;
}

.publish-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--bar-bg);
  border-top: 1px solid var(--border);
  box-shadow: var(--bar-shadow);
  backdrop-filter: blur(10px);
}

.publish-bar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.publish-bar-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 140px;
}

.publish-bar-meta strong {
  color: var(--success-text);
  font-size: 1.1rem;
}

.meta-sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}

.publish-bar-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.publish-bar-actions .btn {
  min-width: 8.5rem;
  padding: 0.7rem 1.25rem;
}

.publish-bar-form {
  margin: 0;
  display: inline;
}

.publish-bar-form .btn {
  min-width: 8.5rem;
}

.publish-bar-hint {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.inline-form {
  margin: 0;
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .workspace-split {
    grid-template-columns: 1fr;
  }

  .pane-tiktok {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .pane-video-list .video-grid {
    max-height: 240px;
  }

  .pane-fp-grid {
    max-height: 220px;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 0.85rem 0.75rem calc(6.5rem + env(safe-area-inset-bottom, 0px));
  }

  .topnav {
    height: auto;
  }

  .topnav-inner {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.4rem 0.5rem;
    align-items: center;
  }

  .brand-text span {
    display: none;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .brand-text h1 {
    font-size: 1rem;
  }

  .topnav-links {
    order: 10;
    flex: 1 1 100%;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.2rem;
    padding: 0.1rem 0 0.15rem;
    margin: 0 -0.15rem;
  }

  .topnav-links::-webkit-scrollbar {
    display: none;
  }

  .topnav-link {
    white-space: nowrap;
    font-size: 0.8125rem;
    padding: 0.45rem 0.65rem;
    flex-shrink: 0;
  }

  .topnav-end {
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    max-width: 100%;
  }

  .nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-width: min(100%, 14rem);
  }

  .nav-pill {
    font-size: 0.625rem;
    padding: 0.2rem 0.45rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-banner {
    padding: 1.25rem 0;
  }

  .flow-strip {
    display: none;
  }

  .step-header,
  .step-body {
    padding: 1.15rem;
  }

  .dash-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .dash-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    width: 100%;
  }

  .metric {
    min-width: 0;
    padding: 0.45rem 0.35rem;
  }

  .metric-val {
    font-size: 1.05rem;
  }

  .metric-lbl {
    font-size: 0.58rem;
  }

  .dash-fb {
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  .fb-inline {
    flex-direction: column;
    align-items: stretch;
    padding: 0 0.65rem 0.65rem;
  }

  .fb-inline input,
  .fb-inline .btn {
    width: 100%;
  }

  .workspace-inner {
    padding: 0.75rem 0.65rem;
  }

  .scan-row {
    flex-direction: column;
    align-items: stretch;
  }

  .scan-inline,
  .scan-inline-main {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    width: 100%;
  }

  .scan-inline textarea {
    width: 100%;
    min-height: 2.75rem;
    font-size: 16px;
  }

  .scan-inline .btn {
    width: 100%;
    min-height: 44px;
  }

  .cookies-setup-form {
    flex-direction: column;
    align-items: stretch;
  }

  .cookies-setup-form .btn,
  .cookies-setup-form textarea,
  .cookies-setup-form input[type="file"] {
    width: 100%;
  }

  .picker-duo {
    grid-template-columns: 1fr;
  }

  .picker-scroll {
    max-height: min(42vh, 220px);
  }

  .publish-meta {
    flex-direction: column;
    gap: 0.75rem;
  }

  .publish-bar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .publish-bar-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 0.65rem 0.75rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    gap: 0.55rem;
  }

  .publish-bar-meta {
    min-width: 0;
    font-size: 0.8125rem;
    text-align: center;
  }

  .publish-bar-meta strong {
    font-size: 1rem;
  }

  .publish-bar-actions {
    width: 100%;
    flex-direction: column;
  }

  .publish-bar-actions .btn,
  .publish-bar-form,
  .publish-bar-form .btn {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .btn-schedule {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .schedule-preview {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .vf-modal {
    align-items: flex-end;
    padding: 0;
  }

  .vf-modal-panel {
    width: 100%;
    max-height: min(92vh, 100%);
    border-radius: 14px 14px 0 0;
    margin: 0;
  }

  .jobs-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .jobs-total {
    align-self: flex-start;
  }

  .jobs-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .jobs-toolbar .btn {
    width: 100%;
    min-height: 44px;
  }

  .queue-del-hint {
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .jobs-table-scroll {
    margin: 0 -0.35rem;
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
  }

  .jobs-table-scroll table {
    min-width: 36rem;
    font-size: 0.8125rem;
  }

  .jobs-table-scroll th,
  .jobs-table-scroll td {
    padding: 0.55rem 0.5rem;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .page-jobs .data-section {
    padding-left: 0;
    padding-right: 0;
  }

  .site-footer {
    padding: 1rem 0.75rem calc(1rem + env(safe-area-inset-bottom, 0px));
    font-size: 0.75rem;
  }

  .btn:not(.btn-sm) {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 40px;
  }

  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
  }
}

@media (max-width: 480px) {
  .page {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .dash-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-lbl {
    font-size: 0.6rem;
  }

  .stat-card .value {
    font-size: 1.65rem;
  }

  .topnav-link {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
  }

  .nav-pills {
    max-width: 100%;
  }

  .fb-account-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .fb-account-select-form,
  .fb-account-select-form .btn {
    width: 100%;
  }

  .publish-bar-meta .meta-sep {
    display: block;
    height: 0;
    overflow: hidden;
    margin: 0;
  }
}
