/* ============ Homie AutoPost — giao diện ============ */
:root {
  --bg: #f4f6fb; --panel: #ffffff; --panel-2: #f8fafc; --text: #0f172a; --text-2: #334155; --muted: #64748b; --line: #e5e9f0; --line-2: #eef1f6;
  --brand: #2563eb; --brand-600: #1d4ed8; --brand-50: #eff4ff; --brand-100: #dbe6fe;
  --ok: #16a34a; --ok-bg: #e8f7ee; --warn: #b45309; --warn-bg: #fff6e0; --err: #dc2626; --err-bg: #fdecec;
  --info: #0369a1; --info-bg: #e6f4fb; --skip: #94a3b8; --skip-bg: #f1f5f9;
  --side: #0b1220; --side-2: #131c2e; --side-text: #a9b4c8; --side-active: #ffffff;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --panel: #111a2c; --panel-2: #0f1728; --text: #e5eaf3; --text-2: #c3cad8; --muted: #8b97ad; --line: #1f2a40; --line-2: #1a2438;
    --brand: #5b8cff; --brand-600: #7aa2ff; --brand-50: #16223d; --brand-100: #1d2c4f;
    --ok: #4ade80; --ok-bg: #11291c; --warn: #fbbf24; --warn-bg: #2d240c; --err: #f87171; --err-bg: #2d1414;
    --info: #7dd3fc; --info-bg: #0d2536; --skip: #64748b; --skip-bg: #1a2335;
    --side: #080d18; --side-2: #111a2c;
    --shadow: none; --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
small, .muted { color: var(--muted); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.xl { width: 40px; height: 40px; stroke-width: 1.5; color: var(--muted); }
.nowrap { white-space: nowrap; }
.t-warn { color: var(--warn); }

/* ---------- Bố cục ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand b { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.brand small { color: var(--side-text); font-size: 12px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 4px 12px rgba(37, 99, 235, .4); }
.nav { flex: 1; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #5b6780; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--side-text); font-weight: 500; margin-bottom: 1px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--brand); color: var(--side-active); box-shadow: 0 4px 14px rgba(37, 99, 235, .35); }
.nav-badge { margin-left: auto; background: #ef4444; color: #fff; border-radius: 99px; font-size: 11px; font-weight: 600; padding: 0 7px; line-height: 18px; }
.nav-badge.live { background: #22c55e; }
.nav a.active .nav-badge { background: rgba(255, 255, 255, .25); }
.side-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--side-2); padding: 12px 6px 2px; margin-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 99px; background: var(--side-2); display: grid; place-items: center; font-weight: 600; color: #fff; }
.side .icon-btn { color: var(--side-text); border-color: transparent; background: transparent; }
.side .icon-btn:hover { background: var(--side-2); color: #fff; }
.side-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 600; color: var(--text-2); }
.topbar .grow { flex: 1; }
.content { padding: 24px 28px 64px; max-width: 1400px; width: 100%; }
.icon-btn.menu-btn { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }

/* ---------- Thành phần chung ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13px; font-weight: 500; }
.grid { display: grid; gap: 16px; }
.two { grid-template-columns: 1fr 1fr; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.empty { color: var(--muted); padding: 14px 4px; text-align: center; }
.empty-state { display: grid; place-items: center; text-align: center; gap: 6px; padding: 44px 20px; }
.empty-state p { margin: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; transition: border-color .15s, background .15s, box-shadow .15s; text-decoration: none !important; }
.btn:hover { border-color: #c5cfdf; background: var(--panel-2); }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); background: var(--err-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 11px 18px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }

/* Form */
label { display: block; font-weight: 500; font-size: 13px; color: var(--text-2); margin: 12px 0 6px; }
label.inline { display: inline-flex; gap: 7px; align-items: center; font-weight: 400; margin: 0; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); padding: 0; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.form-err { color: var(--err); margin: 10px 0 0; font-weight: 500; }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-size: 12.5px; }

/* Bảng */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 6px 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
table.compact th, table.compact td { padding: 8px 10px; }
td.note { max-width: 320px; color: var(--muted); font-size: 13px; }
td.note a { margin-left: 6px; }

/* Nhãn trạng thái */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--skip-bg); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.b-success, .b-live { background: var(--ok-bg); color: var(--ok); }
.b-pending, .b-unknown { background: var(--info-bg); color: var(--info); }
.b-running { background: var(--brand-50); color: var(--brand); }
.b-pending_approval, .b-contacted, .b-potential { background: var(--warn-bg); color: var(--warn); }
.b-failed, .b-checkpoint, .b-logged_out, .b-blocked, .b-error { background: var(--err-bg); color: var(--err); }
.tag { display: inline-block; background: var(--brand-50); color: var(--brand); padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; margin: 1px 3px 1px 0; }
.hot { color: var(--err); font-weight: 600; }

/* ---------- Thanh trên cùng ---------- */
.run-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; text-decoration: none !important; }
.run-chip b { color: var(--text); }
.mini-bar { width: 70px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.pulse { width: 8px; height: 8px; border-radius: 99px; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 1.8s infinite; flex: none; }
.pulse.off { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.sys-toggle { display: inline-flex; align-items: center; gap: 8px; border-radius: 99px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid; }
.sys-toggle .dot { width: 8px; height: 8px; border-radius: 99px; background: currentColor; }
.sys-toggle.is-on { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.sys-toggle.is-off { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.bell { position: relative; }
.bell .dot { position: absolute; top: -5px; right: -5px; background: #ef4444; color: #fff; border-radius: 99px; font-size: 10.5px; font-weight: 600; padding: 0 5px; line-height: 17px; }
.dropdown { position: absolute; right: 0; top: 46px; width: min(400px, 92vw); max-height: 72vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 40; }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.notif { padding: 12px 16px; border-bottom: 1px solid var(--line-2); border-left: 3px solid transparent; }
.notif.unread { background: var(--brand-50); }
.notif.n-error { border-left-color: var(--err); }
.notif.n-lead { border-left-color: #f97316; }
.notif.n-comment { border-left-color: var(--brand); }
.notif.n-success { border-left-color: var(--ok); }
.notif-body { white-space: pre-line; color: var(--text-2); font-size: 13px; margin: 3px 0 4px; }
.pause-on { display: flex; align-items: center; gap: 12px; background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; }
.pause-on div { flex: 1; }

/* ---------- Bảng điều khiển ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; }
.kpi.link:hover { border-color: var(--brand); }
.kpi small { display: block; font-size: 12.5px; }
.kpi b { display: block; font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi-ic .ic { width: 20px; height: 20px; }
.c-blue { background: #e0ecff; color: #2563eb; } .c-indigo { background: #e9e7fe; color: #5b4ff0; } .c-amber { background: #fef3d6; color: #c47b04; }
.c-red { background: #fde4e4; color: #dc2626; } .c-green { background: #dcf5e6; color: #15803d; } .c-rose { background: #ffe6d9; color: #ea580c; }
@media (prefers-color-scheme: dark) {
  .c-blue { background: #172a4d; color: #7aa7ff; } .c-indigo { background: #221f4a; color: #a59dff; } .c-amber { background: #33280c; color: #fbbf24; }
  .c-red { background: #361616; color: #f87171; } .c-green { background: #0f2c1c; color: #4ade80; } .c-rose { background: #3a1d10; color: #fb923c; }
}
.dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-grid .card { margin: 0; }
.mini-batch { display: block; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); margin-bottom: 8px; color: var(--text); text-decoration: none !important; }
.mini-batch:hover { border-color: var(--brand-100); background: var(--panel-2); }
.mini-batch .pbar { margin: 7px 0 5px; }
.acc-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.acc-mini div { background: var(--panel-2); border-radius: var(--radius-sm); padding: 12px; }
.acc-mini small { display: block; font-size: 12px; }
.acc-mini b { font-size: 20px; }
.rank { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.rank:last-child { border-bottom: 0; }
.rank a { flex: 1; }
.rank-n { width: 22px; height: 22px; border-radius: 6px; background: var(--brand-50); color: var(--brand); font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 6px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 100%; max-width: 34px; display: flex; flex-direction: column; border-radius: 6px 6px 3px 3px; overflow: hidden; min-height: 3px; }
.bar-ok { background: linear-gradient(180deg, #4f86f7, #2563eb); min-height: 0; }
.bar-err { background: #f87171; min-height: 0; }
.bars small { font-size: 11px; }
.onboarding .steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.onboarding .steps li { counter-increment: s; background: var(--panel-2); border-radius: var(--radius-sm); padding: 14px; display: grid; gap: 4px; }
.onboarding .steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.onboarding .steps span { color: var(--muted); font-size: 13px; }

/* ---------- Tiến độ ---------- */
.tabs { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: transparent; font: inherit; font-weight: 500; color: var(--muted); padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--brand-50); color: var(--brand); }
.tabs button span { background: var(--line); color: var(--text-2); border-radius: 99px; font-size: 11px; padding: 0 6px; margin-left: 4px; }
.pbar { flex: 1; display: flex; height: 12px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.pbar.sm { height: 6px; }
.pbar span { height: 100%; transition: width .5s ease; }
.s-ok { background: #22c55e; } .s-wait { background: #f59e0b; } .s-err { background: #ef4444; } .s-skip { background: #a3aec2; }
.s-run { background: repeating-linear-gradient(45deg, #3b82f6 0 8px, #60a5fa 8px 16px); background-size: 200% 100%; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 22px 0; } }
.batch { padding: 20px 22px 12px; }
.batch.st-paused { border-left: 4px solid var(--warn); }
.batch.st-running { border-left: 4px solid var(--brand); }
.batch.st-done { border-left: 4px solid var(--ok); }
.batch.st-cancelled { border-left: 4px solid var(--skip); }
.batch-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.batch-title b { font-size: 16px; margin-right: 8px; }
.batch-title .muted { font-size: 12.5px; margin-top: 3px; }
.batch-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.status-pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; vertical-align: 2px; }
.sp-running { background: var(--brand-50); color: var(--brand); } .sp-paused { background: var(--warn-bg); color: var(--warn); }
.sp-done { background: var(--ok-bg); color: var(--ok); } .sp-cancelled { background: var(--skip-bg); color: var(--muted); }
.batch-progress { display: flex; align-items: center; gap: 14px; margin: 16px 0 14px; }
.batch-progress .pct { font-size: 18px; min-width: 52px; text-align: right; }
.nums { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.nums div { background: var(--panel-2); border-radius: var(--radius-sm); padding: 9px 12px; }
.nums small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nums b { font-size: 19px; }
.n-ok b { color: var(--ok); } .n-wait b { color: var(--warn); } .n-err b { color: var(--err); } .n-skip b { color: var(--muted); }
.batch-now { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; background: var(--brand-50); border-radius: var(--radius-sm); font-size: 13.5px; }
.batch.st-paused .batch-now { background: var(--warn-bg); }
.now-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.now-line .ic { width: 16px; height: 16px; color: var(--muted); }
.expand { display: flex; align-items: center; gap: 6px; margin: 10px auto 0; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.expand:hover { color: var(--brand); background: var(--brand-50); }
.expand .ic { width: 16px; height: 16px; transition: transform .2s; }
.batch .table-wrap { margin-top: 8px; border-top: 1px solid var(--line-2); }
.live-card { display: grid; gap: 14px; }
.live-item { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: center; }
.live-item img { width: 100%; aspect-ratio: 1366 / 900; object-fit: cover; object-position: top; border-radius: var(--radius-sm); border: 1px solid var(--line); cursor: zoom-in; background: var(--panel-2); }
.live-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: #16a34a; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.live-big { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); min-height: 200px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); display: grid; place-items: start center; padding: 48px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--panel); border-radius: 18px; width: 100%; max-width: 680px; padding: 24px; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 940px; }
.modal h2 { font-size: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-2); }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs div { position: relative; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.thumbs button { position: absolute; top: -6px; right: -6px; border: 0; background: var(--err); color: #fff; border-radius: 99px; width: 22px; height: 22px; cursor: pointer; line-height: 1; }
.pick-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; background: var(--panel-2); }
.pick-list label { font-weight: 400; margin: 0; padding: 7px 8px; border-radius: 8px; display: flex; gap: 10px; align-items: center; cursor: pointer; color: var(--text); }
.pick-list label:hover { background: var(--panel); }
pre.content { white-space: pre-wrap; font: inherit; margin: 8px 0; max-height: 110px; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.save-bar { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; }
.save-bar .btn { box-shadow: var(--shadow-lg); }

.toast { position: fixed; bottom: 24px; right: 24px; background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 100; max-width: min(440px, 90vw); box-shadow: var(--shadow-lg); font-weight: 500; }
.toast.err { background: var(--err); }

/* Đăng nhập */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 10% -10%, #dbe6fe 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e0e7ff 0, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow-lg); }
.login-card .brand { padding: 0 0 12px; }
.login-card .brand b { color: var(--text); font-size: 17px; }
.login-card .brand small { color: var(--muted); }

/* Sức khoẻ tài khoản */
.health { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.meter { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 5px 0 8px; }
.meter div { height: 100%; border-radius: 99px; background: var(--ok); transition: width .3s; }
.h-warn .meter div { background: #f59e0b; }
.h-bad .meter div { background: var(--err); }
.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12.5px; color: var(--muted); }
.health-grid b { color: var(--text); }
.cooldown { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 10px; font-size: 13px; }

/* Đăng nhập Facebook từ xa */
.seg { display: flex; gap: 6px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 4px; }
.seg button { flex: 1; min-width: 200px; border: 0; background: transparent; color: var(--muted); padding: 9px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 500; }
.seg button.on { background: var(--panel); color: var(--brand); box-shadow: var(--shadow); }
.fbl-hint { background: var(--info-bg); color: var(--info); padding: 10px 14px; border-radius: var(--radius-sm); margin: 12px 0; }
.fbl-screen { position: relative; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; outline: none; aspect-ratio: 1000 / 760; }
.fbl-screen.focused { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.fbl-screen img { display: block; width: 100%; height: 100%; cursor: pointer; user-select: none; }
.fbl-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #555; background: #f0f2f5; }
.fbl-keys { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; pointer-events: none; font-size: 16px; }

/* ---------- Điện thoại / máy tính bảng ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nums { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 55; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .topbar-title { display: none; }
  .sys-toggle span:last-child { display: none; }
  .sys-toggle { padding: 9px; }
  .run-chip .mini-bar, .run-chip > span:nth-child(2) { display: none; }
  .content { padding: 18px 16px 60px; }
  .two { grid-template-columns: 1fr; }
  .nums { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .live-item { grid-template-columns: 1fr; }
  .acc-mini { grid-template-columns: 1fr 1fr 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 12px; gap: 10px; }
  .kpi b { font-size: 22px; }
  h1 { font-size: 20px; }
}

/* ---------- Nhiều người dùng ---------- */
.user-chip > div { line-height: 1.25; }
.user-chip small { color: var(--side-text); font-size: 11.5px; font-weight: 400; }
.viewas { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--muted); }
.viewas select { border: 0; background: transparent; padding: 7px 6px; width: auto; max-width: 180px; font-weight: 500; color: var(--text); box-shadow: none !important; }
.viewas-bar { display: flex; align-items: center; gap: 12px; background: var(--brand-50); color: var(--brand); border: 1px solid var(--brand-100); padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; }
.viewas-bar div { flex: 1; color: var(--text-2); }
.owner { display: inline-block; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2); border-radius: 6px; padding: 0 7px; }
.scope-tag { font-size: 11px; font-weight: 600; background: var(--brand-50); color: var(--brand); border-radius: 6px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.user-card { margin: 0; }
.user-card.locked { opacity: .65; }
.user-head { display: flex; align-items: center; gap: 12px; }
.avatar.lg { width: 42px; height: 42px; font-size: 17px; background: linear-gradient(135deg, #3b82f6, #6366f1); flex: none; }
.user-flags { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.user-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.user-stats div { background: var(--panel-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.user-stats small { display: block; font-size: 11.5px; }
.user-stats b { font-size: 17px; }
.user-meta { font-size: 12.5px; margin-top: 8px; }
@media (max-width: 860px) { .viewas select { max-width: 110px; } .user-grid { grid-template-columns: 1fr; } }

/* Ước tính trước khi đăng */
.est-box { margin-top: 14px; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }
.est-box.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.est-line { display: flex; gap: 9px; align-items: flex-start; margin: 3px 0; }
.est-line .ic { width: 16px; height: 16px; margin-top: 2px; color: var(--brand); }
.est-box.warn .est-line .ic { color: var(--warn); }
.est-tip { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--text-2); }

/* Lần đăng gần nhất của group */
.pick-list label.g-row { align-items: flex-start; }
.g-row input { margin-top: 3px; }
.g-main { flex: 1; min-width: 0; }
.g-name { margin-right: 4px; }
.g-row.not-ready .g-name { color: var(--muted); }
.g-state { display: inline-flex; flex-direction: column; align-items: flex-end; flex: none; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 8px; white-space: nowrap; text-align: right; line-height: 1.35; }
.g-state small { font-weight: 400; font-size: 11px; color: inherit; opacity: .85; }
td .g-state { align-items: flex-start; text-align: left; }
.gs-recent { background: var(--err-bg); color: var(--err); }
.gs-ok { background: var(--ok-bg); color: var(--ok); }
.gs-never { background: var(--skip-bg); color: var(--muted); font-weight: 500; }
.gs-queued { background: var(--info-bg); color: var(--info); }
.warn-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; font-size: 13px; }
.warn-line span { flex: 1; min-width: 200px; }
@media (max-width: 860px) { .g-state { font-size: 11px; padding: 2px 6px; } }

/* Chống spam theo tài khoản */
.safety-box { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel-2); }
.safety-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--brand); }
.safety-title b { color: var(--text); }
.safety-sum { margin-top: 6px; font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 8px; }
.safety-sum.custom { color: var(--brand); background: var(--brand-50); border-color: var(--brand-100); }
.risk { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: 9px; font-weight: 500; font-size: 13px; }
.risk-dot { width: 9px; height: 9px; border-radius: 99px; background: currentColor; flex: none; }
.risk-low { background: var(--ok-bg); color: var(--ok); }
.risk-mid { background: var(--warn-bg); color: var(--warn); }
.risk-high { background: var(--err-bg); color: var(--err); }
details.adv { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; }
details.adv > summary { cursor: pointer; padding: 10px 0; font-weight: 500; color: var(--text-2); }
details.adv[open] { padding-bottom: 14px; }
.rhythm-line { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand); border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; margin: 12px 0 0; }
.notif.clickable { cursor: pointer; }
.notif.clickable:hover { background: var(--panel-2); }
.notif.unread.clickable:hover { background: var(--brand-100); }
.open-link { color: var(--brand); font-weight: 500; font-size: 13px; }
.dropdown-head .row { gap: 6px; }
.pause-on.danger-banner { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
