:root {
  --bg: #F5F6FA; --text: #526484; --head: #0F172A; --blue: #0066FF; --navy: #1F3466;
  --orange: #FF7700; --rail: #101B33; --line: #E5E9F2; --soft: #EEF3FF; --purple: #EDE9FE;
  --card-r: 14px; --btn-r: 7px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Roboto, system-ui, sans-serif; color: var(--text); background: var(--bg); }
h1, h2, h3, .card-title, .sub-title { font-family: Nunito, sans-serif; color: var(--head); margin: 0; }
button { font: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.app { display: flex; min-height: 100vh; }

/* ---- Cột menu trái ---- */
.rail { position: fixed; inset: 0 auto 0 0; width: 68px; background: var(--rail); color: #C8D1E6; display: flex; flex-direction: column; align-items: center; padding: 10px 0; z-index: 40; }
.rail-logo { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--rail); display: grid; place-items: center; font-size: 22px; margin-bottom: 12px; }
.rail-items { display: flex; flex-direction: column; gap: 2px; width: 100%; overflow-y: auto; }
.rail-item { background: none; border: 0; color: inherit; width: 100%; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; line-height: 1.2; }
.rail-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.rail-item.active { background: var(--blue); color: #fff; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-btn { background: none; border: 0; color: inherit; padding: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #C62828; color: #fff; font-size: 11px; font-weight: 700; }

/* ---- Menu cấp 2 ---- */
.subnav { position: fixed; top: 0; bottom: 0; left: 68px; width: 210px; background: #fff; border-right: 1px solid var(--line); padding: 12px 10px; transform: translateX(-110%); transition: transform .22s ease; z-index: 30; overflow-y: auto; }
.subnav.open { transform: none; }
.sub-group { margin-bottom: 8px; }
.sub-group-head { width: 100%; display: flex; justify-content: space-between; align-items: center; background: #F7F8FB; border: 0; border-radius: 6px; padding: 7px 10px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #8A94A6; text-transform: uppercase; }
.sub-group-head .chev { transition: transform .2s; }
.sub-group.closed .chev { transform: rotate(-90deg); }
.sub-group.closed .sub-list { display: none; }
.sub-list { list-style: none; margin: 4px 0 0; padding: 0; }
.sub-link { width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 10px; display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 13px; }
.sub-link svg { width: 16px; height: 16px; }
.sub-link:hover { background: var(--soft); }
.sub-link.active { background: var(--soft); color: var(--blue); font-weight: 500; }
.scrim { display: none; }

/* ---- Khung chính ---- */
.main { flex: 1; margin-left: 68px; min-width: 0; transition: margin-left .22s; }
.app.has-sub .main { margin-left: 278px; }
.topbar { position: sticky; top: 0; z-index: 20; height: 44px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.trial { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--head); white-space: nowrap; }
.grid-btn { margin-left: auto; }
.hamburger { display: none; background: none; border: 0; font-size: 20px; color: var(--head); padding: 4px; }
.content { padding: 20px 24px 120px; max-width: 1400px; margin: 0 auto; }

/* ---- Nút ---- */
.btn { border: 0; border-radius: var(--btn-r); padding: 7px 14px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-dark { background: #111827; color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-ghost { background: #fff; color: var(--blue); border: 1px solid #BFD4FF; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.icon-btn { background: none; border: 0; color: var(--text); padding: 4px; }

/* ---- Bảng tin ---- */
.greet { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.greet h1 { font-size: 20px; font-weight: 800; }
.hero { position: relative; text-align: center; padding: 56px 12px 40px; margin: 8px 0 20px; border-radius: 20px;
  background: radial-gradient(600px 220px at 20% 30%, rgba(0,102,255,.08), transparent 70%), radial-gradient(500px 200px at 85% 70%, rgba(124,58,237,.07), transparent 70%); }
.hero::before, .hero::after { content: "✦"; position: absolute; color: #9DB8F5; font-size: 14px; }
.hero::before { left: 14%; top: 34%; } .hero::after { right: 12%; top: 22%; }
.hero h2 { font-size: 30px; font-weight: 800; line-height: 1.25; }
.hero h2 em { font-style: normal; color: var(--orange); }
.pills { display: inline-flex; gap: 6px; margin: 18px 0 14px; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 14px; font-size: 13px; color: var(--text); display: inline-flex; gap: 6px; align-items: center; }
.pill svg { width: 15px; height: 15px; }
.pill.on { background: #111827; color: #fff; border-color: #111827; }
.ask { width: 100%; max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 18px; box-shadow: 0 6px 24px rgba(15,23,42,.06); }
.ask input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; color: var(--head); padding: 8px 0; }
.send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
.send svg { width: 18px; height: 18px; }
.chips { max-width: min(860px, 100%); margin: 16px auto 0; overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.chips-track { display: flex; gap: 8px; width: max-content; animation: marquee 40s linear infinite; }
.chips:hover .chips-track { animation-play-state: paused; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--text); white-space: nowrap; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .chips-track { animation: none; } .chips { overflow-x: auto; scrollbar-width: none; } }

.card { background: #fff; border-radius: var(--card-r); box-shadow: 0 1px 3px rgba(15,23,42,.05); padding: 16px 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-title { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.card-head .muted { font-size: 12px; }
.muted { color: #8A94A6; }

.eco-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 12px; }
.products { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.product { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; text-align: left; }
.product .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; margin-bottom: 8px; }
.product .dot svg { width: 16px; height: 16px; }
.product b { display: block; font-family: Nunito, sans-serif; font-size: 12px; color: var(--head); text-transform: uppercase; }
.product span { font-size: 12px; }
.soon { position: absolute; top: 8px; right: 8px; background: var(--orange); color: #fff; font-size: 10px; border-radius: 4px; padding: 1px 6px; }

.grid { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: 1 / -1; }

.mini-empty { text-align: center; padding: 18px 8px; background: #FAFBFD; border-radius: 10px; }
.mini-empty .ill { width: 46px; height: 46px; border-radius: 50%; background: var(--purple); color: #7C3AED; display: grid; place-items: center; margin: 0 auto 8px; }
.mini-empty b { display: block; color: var(--head); font-weight: 500; }
.mini-empty p { margin: 2px 0 10px; font-size: 12px; }

.quota { display: grid; grid-template-columns: 90px 1fr 40px; gap: 8px; align-items: center; font-size: 12px; margin: 6px 0; }
.quota .bar { height: 6px; border-radius: 99px; background: #EEF1F6; overflow: hidden; }
.quota .bar i { display: block; height: 100%; background: var(--blue); }
.quota b { text-align: right; color: var(--head); }
.expire { text-align: center; border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; font-size: 12px; }
.expire b { color: var(--orange); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; background: #F7F8FB; color: #6B7A99; font-weight: 500; text-transform: uppercase; padding: 10px 12px; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--head); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; background: #E8F0FF; color: var(--blue); }
.tag.done { background: #E7F7EE; color: #138A4B; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat span { font-size: 12px; }
.stat b { display: block; font: 800 26px Nunito, sans-serif; color: var(--head); }
.up { color: #138A4B; font-size: 12px; } .down { color: #D92D20; font-size: 12px; }

/* ---- Ô trống trang con ---- */
.empty { max-width: 640px; margin: 24px auto; text-align: center; }
.mock { background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(15,23,42,.10); overflow: hidden; text-align: left; margin-bottom: 22px; }
.mock-bar { background: #1E2A44; height: 26px; display: flex; gap: 5px; align-items: center; padding: 0 10px; }
.mock-bar i { width: 8px; height: 8px; border-radius: 50%; background: #5B6B8C; }
.mock-body { display: grid; grid-template-columns: 30% 1fr; min-height: 200px; }
.mock-side { background: #F3F5F9; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.mock-side i, .mock-main i { display: block; height: 10px; border-radius: 4px; background: #DCE2EC; }
.mock-main { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.mock-main .row { display: flex; gap: 10px; align-items: center; }
.mock-main .row u { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.mock-main .blk { height: 54px; border-radius: 8px; background: #EEF3FF; }
.empty h2 { font-size: 20px; font-weight: 800; }
.empty p { margin: 6px 0 16px; }

/* ---- Trang AI chat ---- */
.chat-page { min-height: calc(100vh - 160px); display: flex; flex-direction: column; justify-content: center; text-align: center; background-image: radial-gradient(#DDE3EE 1px, transparent 1px); background-size: 18px 18px; border-radius: 16px; padding: 40px 12px; }
.chat-page h2 { font-size: 28px; font-weight: 800; }
.chat-page h2 em { font-style: normal; color: #C026D3; }

/* ---- Bảng hướng dẫn ---- */
.guide { position: fixed; right: 20px; bottom: 20px; width: 300px; background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(15,23,42,.22); overflow: hidden; z-index: 50; }
.guide-head { background: var(--blue); color: #fff; display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.guide-head b { flex: 1; font-weight: 500; }
.guide-head button { background: none; border: 0; color: #fff; font-size: 16px; padding: 0 4px; }
.guide-bar { background: var(--blue); display: flex; gap: 4px; padding: 0 14px 12px; }
.guide-bar i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.35); }
.guide-bar i.on { background: #fff; }
.guide-steps { list-style: none; margin: 0; padding: 10px 14px; max-height: 260px; overflow-y: auto; }
.guide-steps li { display: grid; grid-template-columns: 24px 1fr; gap: 2px 8px; padding: 8px 0; }
.guide-steps input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--blue); cursor: pointer; }
.guide-steps label { color: var(--head); font-weight: 500; cursor: pointer; }
.guide-steps small { grid-column: 2; font-size: 12px; }
.guide-steps li.done label, .guide-steps li.done small { text-decoration: line-through; color: #A0A9BA; }
.guide-foot { text-align: center; font-size: 12px; margin: 0; padding: 8px; border-top: 1px solid var(--line); }
.guide-foot a { color: var(--blue); }
.guide-pill { position: fixed; right: 16px; bottom: 16px; z-index: 50; border: 0; border-radius: 999px; background: var(--blue); color: #fff; padding: 9px 16px; box-shadow: 0 6px 20px rgba(0,102,255,.35); }

.toast { position: fixed; left: 50%; top: 56px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; background: #111827; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 60; transition: .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Màn vừa ---- */
@media (max-width: 1100px) {
  .products { grid-template-columns: repeat(3, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .span-2 { grid-column: 1 / -1; }
}

/* ---- Điện thoại / máy tính bảng dọc: menu thành ☰ ---- */
@media (max-width: 768px) {
  .rail { transform: translateX(-100%); transition: transform .22s; }
  .app.nav-open .rail { transform: none; }
  .subnav, .subnav.open { left: 0; transform: translateX(-110%); }
  .app.nav-open .subnav.open { left: 68px; transform: none; width: min(210px, calc(100vw - 84px)); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 25; }
  .main, .app.has-sub .main { margin-left: 0; }
  .hamburger { display: block; }
  .app.nav-open ~ .guide, .app.nav-open ~ .guide-pill { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 16px 16px 90px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .products { grid-template-columns: 1fr 1fr; gap: 8px; }
  .soon { position: static; display: inline-block; margin-bottom: 4px; }
  .span-2, .span-3 { grid-column: auto; }
  .hero { padding: 32px 4px 24px; }
  .hero h2, .chat-page h2 { font-size: 22px; }
  .greet h1 { font-size: 17px; }
  .mock-body { min-height: 150px; }
  /* Bảng hướng dẫn: dải dưới đáy, tối đa 40% màn, không che nửa màn */
  .guide { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .guide-steps { max-height: calc(40vh - 120px); min-height: 80px; }
}
@media (max-width: 400px) {
  .trial { font-size: 12px; }
  .topbar .btn-navy { padding: 6px 10px; font-size: 12px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat b { font-size: 22px; }
}

/* ===== Tính năng (bản 2) ===== */
.link { background: none; border: 0; padding: 0; color: var(--blue); font-size: 12px; cursor: pointer; text-decoration: none; }
.center { text-align: center; }
.note { background: #FFF7ED; color: #9A3412; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.btn-danger { background: #fff; color: #D92D20; border: 1px solid #FECACA; }
.btn:disabled { opacity: .6; cursor: wait; }
.sub-title { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 800; }
.sec-title { font: 800 14px Nunito, sans-serif; color: var(--head); margin: 18px 0 10px; }
.row-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--text); }
.tab.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.grid > .card, .board > .card { align-self: start; }
.content > section.card { margin-bottom: 12px; }

/* Hộp thoại */
#modal { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(15,23,42,.3); color: var(--text); }
#modal.wide { width: min(680px, calc(100vw - 24px)); }
#modal::backdrop { background: rgba(15,23,42,.45); }
.modal-box { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head b { font: 800 16px Nunito, sans-serif; color: var(--head); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal-foot .btn-danger { order: -1; margin-right: auto; }
.f-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--head); font-weight: 500; flex: 1; min-width: 0; }
.f-field input, .f-field select, .f-field textarea, .inline-form input { font: 14px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 8px; padding: 8px 10px; color: var(--head); background: #fff; width: 100%; }
.f-field textarea { resize: vertical; }
.f-field input[type=checkbox], .f-field input[type=radio] { width: auto; padding: 0; }
.f-field input:focus, .f-field select:focus, .f-field textarea:focus, .inline-form input:focus { outline: 2px solid #BFD4FF; border-color: var(--blue); }
.f-row { display: flex; gap: 12px; flex-wrap: wrap; }
.f-row > * { min-width: 180px; }
.ch-pick, .group-btns { display: flex; flex-wrap: wrap; gap: 6px; font-weight: 400; }
.group-btns { margin-bottom: 6px; }
.ch-opt { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; }
.net-dot { width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.net-dot.big { width: 34px; height: 34px; font-size: 15px; }
.net-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.net-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 4px; font-size: 12px; cursor: pointer; }
.net-opt input { position: absolute; opacity: 0; }
.net-opt:has(input:checked) { border-color: var(--blue); background: var(--soft); }
.net-opt:has(input:focus-visible) { outline: 2px solid var(--blue); }
.preview img, .preview video { max-width: 100%; max-height: 220px; border-radius: 8px; margin-bottom: 8px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.plan.hot { border-color: var(--orange); }
.plan .soon { align-self: flex-start; }
.plan h3 { font-size: 16px; } .plan ul { list-style: none; padding: 0; margin: 0 0 8px; font-size: 13px; flex: 1; }
.price { font: 800 20px Nunito, sans-serif; color: var(--head); margin: 0; } .price small { font-size: 12px; color: var(--text); }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
.note-list b { font-weight: 500; color: var(--head); }
.products.in-modal { grid-template-columns: repeat(2, 1fr); }
.rail-btn.has-dot { position: relative; }
.rail-btn.has-dot::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }

/* Danh sách nhỏ trên bảng tin */
.ch-list, .todo { list-style: none; margin: 0 0 8px; padding: 0; }
.ch-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ch-list li > span:not(.net-dot):not(.tag) { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--head); }
.todo li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.todo b, .link-row b { font-weight: 500; color: var(--head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo.card { padding: 8px 18px; }
.link-row { background: none; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; width: 100%; min-width: 0; color: inherit; }
.top-posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.top-post { text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text); }
.top-post b { color: var(--head); font-size: 13px; font-weight: 500; }
.tag.st-draft { background: #F1F5F9; color: #475569; } .tag.st-wait { background: #FFF7ED; color: #C2410C; }
.tag.st-sched { background: #E8F0FF; color: var(--blue); } .tag.st-done { background: #E7F7EE; color: #138A4B; }

/* Trò chuyện AI */
.chat-page.has-msgs { justify-content: flex-end; text-align: left; }
.msgs { flex: 1; overflow-y: auto; max-height: calc(100vh - 330px); display: flex; flex-direction: column; gap: 10px; padding: 4px 4px 12px; }
.msg { max-width: min(560px, 85%); padding: 10px 14px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; display: flex; flex-direction: column; gap: 6px; }
.msg.me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #fff; color: var(--head); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg small { font-size: 11px; opacity: .7; }
.msg .btn { align-self: flex-start; }
.typing { color: #8A94A6; font-style: italic; }
.chat-page.has-msgs .pills { margin: 12px auto 8px; }
.gen-tile { width: 260px; max-width: 100%; aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; text-align: center; padding: 16px; color: #fff; font-weight: 500; white-space: normal;
  background: linear-gradient(135deg, #6366F1, #EC4899 60%, #F59E0B); overflow: hidden; }
.gen-tile.video { aspect-ratio: 9/16; width: 180px; background: linear-gradient(160deg, #0EA5E9, #1F3466); }
.gen-tile img { width: 100%; height: 100%; object-fit: cover; }
.gen-tile.checker { background: repeating-conic-gradient(#E5E7EB 0 25%, #fff 0 50%) 0 0/20px 20px; padding: 0; }
.gen-tile.checker img { object-fit: contain; }
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gen { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.gen .gen-tile { width: 100%; }
.gen .gen-tile.video { width: 60%; }
.tool-form { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.tool-form .f-field { width: 100%; }

/* Bài viết */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.post-row > div:first-child { flex: 1; min-width: 220px; }
.post-row p { color: var(--head); margin: 6px 0; white-space: pre-wrap; }

/* Lịch */
.cal-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cal-nav b { min-width: 110px; text-align: center; color: var(--head); }
.legend { display: flex; gap: 14px; font-size: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.legend i.st-sched { background: var(--blue); } .legend i.st-done { background: #22C55E; } .legend i.st-wait { background: var(--orange); }
.cal-chip.st-sched { background: #E8F0FF; color: var(--blue); }
.cal-chip.st-done { background: #E7F7EE; color: #138A4B; }
.cal-chip.st-wait { background: #FFF7ED; color: #C2410C; }
.cal { padding: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { text-align: center; font-size: 12px; font-weight: 500; color: #8A94A6; padding: 4px 0; }
.cal-cell { min-height: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-cell:hover { background: #FAFBFD; border-color: #BFD4FF; }
.cal-cell.out { opacity: .45; }
.cal-cell.today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.cal-d { font-size: 12px; font-weight: 500; color: var(--head); }
.cal-chip { border: 0; border-radius: 4px; font-size: 11px; padding: 2px 4px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cell small { font-size: 11px; }

/* Hộp thư */
.inbox { display: grid; grid-template-columns: 300px 1fr; gap: 12px; }
.inbox-list { padding: 12px; max-height: calc(100vh - 170px); overflow-y: auto; }
.convo { display: flex; flex-direction: column; text-align: left; width: 100%; background: none; border: 0; border-radius: 8px; padding: 8px 10px; gap: 2px; font-size: 13px; color: var(--text); }
.convo b { color: var(--head); display: flex; align-items: center; gap: 6px; }
.convo:hover { background: #F7F8FB; } .convo.on { background: var(--soft); }
.unread { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.inbox-thread { display: flex; flex-direction: column; min-height: 420px; }
.thread-head { display: flex; flex-direction: column; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.thread-head b { color: var(--head); }
.thread { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 12px 0; overflow-y: auto; }
.reply { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.reply select { font: 13px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 8px; padding: 6px; color: var(--text); max-width: 100%; }
.reply-row, .inline-form { display: flex; gap: 8px; }
.reply-row input { flex: 1; min-width: 0; font: 14px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 8px; padding: 8px 10px; }
.inline-form { margin-top: 10px; } .inline-form input { flex: 1; min-width: 0; }

/* Biểu đồ thanh */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 160px) 1fr 50px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--head); }
.bar-row .bar { height: 10px; border-radius: 99px; background: #EEF1F6; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.bar-row b { text-align: right; color: var(--head); }
.rep-kpi { margin-bottom: 12px; }
.rep-kpi .stat { background: #fff; }

/* Chiến dịch, ý tưởng, giao việc, khác */
.camp p, .idea p { margin: 6px 0; }
.idea h3 { font-size: 15px; margin: 8px 0 0; }
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.col { background: #EEF1F6; box-shadow: none; }
.task { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--blue); }
.task b { color: var(--head); font-weight: 500; }
.task.late { border-left-color: #D92D20; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-list .chip { display: inline-flex; align-items: center; gap: 4px; color: var(--head); }
.chip .x { background: none; border: 0; color: #8A94A6; font-size: 11px; padding: 0 2px; }
.guide-steps .link { grid-column: 2; justify-self: start; margin-top: 2px; }

@media (max-width: 1100px) { .top-posts { grid-template-columns: 1fr; } .board { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { max-height: 260px; }
  .plans { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cal-cell { min-height: 52px; padding: 3px; }
  .cal-chip { font-size: 0; height: 6px; padding: 0; } /* điện thoại: chỉ hiện vạch màu, chi tiết xem ở danh sách dưới lịch */
  .cal-nav b { min-width: 0; }
  .net-grid { grid-template-columns: repeat(2, 1fr); }
  .f-row > * { min-width: 100%; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .btn-danger { flex-basis: 100%; margin: 0; }
  .msgs { max-height: calc(100vh - 300px); }
  .bar-row { grid-template-columns: 90px 1fr 44px; }
  .reply-row { flex-wrap: wrap; } .reply-row input { flex-basis: 100%; } .reply-row .btn { flex: 1; }
}

/* ===== Vòng 2: Lịch đăng, chi tiết bài, trang soạn, bảng tin ===== */
.grow { flex: 1; }
.small { font-size: 12px; }
.full { width: 100%; }
.nowrap { white-space: nowrap; }
.btn.on { border-color: var(--blue); color: var(--blue); background: var(--soft); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; padding: 0 5px; }
.tag.st-err { background: #FEECEB; color: #D92D20; }
.bg-done { background: #22C55E !important; } .bg-sched { background: var(--blue) !important; } .bg-err { background: #D92D20 !important; }
.sel-sm { font: 13px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 7px; padding: 5px 8px; color: var(--head); background: #fff; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; font-size: 13px; color: var(--text); }
.seg button.on { background: var(--soft); color: var(--blue); font-weight: 500; }
.seg.full { display: flex; margin: 10px 0; } .seg.full button { flex: 1; padding: 9px; }
.row-acts.tight { margin: 0; }

/* Thanh công cụ + bảng danh sách */
.ld-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.ld-search { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #D5DCE8; border-radius: 7px; padding: 0 8px; background: #fff; }
.ld-search input { border: 0; outline: 0; font: 13px Roboto, sans-serif; padding: 6px 0; width: 160px; color: var(--head); }
.ld-card { padding: 0; overflow: hidden; }
.ld-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ld-head b { font-family: Nunito, sans-serif; color: var(--head); font-size: 14px; }
.dot-blue { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.bulk { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--head); }
.ld-table th, .ld-table td { vertical-align: middle; }
.ld-table td { white-space: normal; }
.ld-table td.nowrap { white-space: nowrap; }
.ld-table .ck { width: 36px; }
.ld-table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); }
.ld-table tr.sel td { background: #F3F7FF; }
.ld-text { min-width: 220px; max-width: 340px; }
.ld-text .link-row b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ld-thumb { position: relative; display: inline-block; width: 40px; height: 40px; border-radius: 6px; overflow: hidden; background: #EEF1F6; }
.ld-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ld-thumb i { position: absolute; right: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; font-style: normal; padding: 0 3px; }
.mt-ph { display: grid; place-items: center; width: 100%; height: 100%; min-height: 40px; font-size: 18px; color: #8A94A6; text-align: center; }
.mt-ph small { display: none; }
.stars { white-space: nowrap; }
.star { border: 0; background: none; color: #D5DCE8; font-size: 15px; padding: 0 1px; }
.star.on { color: #F59E0B; }
.empty-row { padding: 28px !important; }
.ld-pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 2px; font-size: 13px; }
.pager { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.goto input { width: 70px; font: 13px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 7px; padding: 5px 8px; }

/* Menu bật lên */
.pop { position: absolute; z-index: 70; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15,23,42,.18); padding: 6px; min-width: 200px; max-width: calc(100vw - 16px); max-height: 60vh; overflow-y: auto; }
.pop-title { font-size: 12px; font-weight: 700; color: #8A94A6; text-transform: uppercase; padding: 6px 8px; }
.pop-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 10px; font-size: 13px; color: var(--head); }
.pop-item:hover, .pop-item:focus { background: var(--soft); outline: 0; }
.pop-item.danger { color: #D92D20; }
.pop-line { padding: 6px 8px; font-size: 13px; display: flex; gap: 6px; align-items: center; color: var(--head); }
.pop-range { display: flex; gap: 6px; align-items: center; padding: 4px 6px; flex-wrap: wrap; }
.pop-range input, .pop select { font: 13px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 7px; padding: 6px; }
.pop .f-field { padding: 0 6px; margin-bottom: 8px; }
.pop-foot { display: flex; gap: 6px; justify-content: flex-end; padding: 6px; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 40px); gap: 2px; }
.emoji-grid button { border: 0; background: none; font-size: 20px; border-radius: 6px; height: 40px; }
.emoji-grid button:hover { background: var(--soft); }

/* Ngăn kéo */
[hidden] { display: none !important; } /* thuộc tính hidden luôn thắng các luật display bên dưới */
.drawer-scrim { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 54; }
.drawer { position: fixed; top: 0; bottom: 0; z-index: 55; width: min(480px, 100vw); background: #fff; box-shadow: 0 0 40px rgba(15,23,42,.25); display: flex; flex-direction: column; }
.drawer.right { right: 0; }
.drawer.left { left: 0; width: min(320px, 100vw); }
.dr-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dr-head b { font: 800 16px Nunito, sans-serif; color: var(--head); }
.dr-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.dr-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.dr-sel { width: 100%; font: 13px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 8px; padding: 8px; color: var(--head); }
.fp-src { border-radius: 10px; background: #F3F7FF; padding: 4px 10px; margin-bottom: 10px; }
.fp-group { border-top: 1px solid var(--line); padding: 8px 0; }
.fp-group summary { cursor: pointer; font-size: 12px; font-weight: 700; color: #8A94A6; letter-spacing: .03em; padding: 4px 0; }
.fp-opt { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; cursor: pointer; color: var(--head); }
.fp-opt > :first-child { flex: 1; }
.fp-opt input { width: 16px; height: 16px; accent-color: var(--blue); }
.sec-sm { display: block; margin: 10px 0 4px; color: var(--head); font-size: 13px; }
.note-row { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); padding: 8px 0; }
.note-row p { margin: 4px 0 0; color: var(--head); white-space: pre-wrap; }
.note-row.done p { text-decoration: line-through; color: #A0A9BA; }
.dr-note { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dr-note textarea { font: 14px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 8px; padding: 8px; resize: vertical; }
.dr-note .btn { align-self: flex-end; }

/* Lịch tuần / tháng */
.legend .st-dot { margin-right: 4px; }
.st-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 10px; font-style: normal; color: #fff; background: #94A3B8; }
.st-dot.st-done { background: #22C55E; }
.st-dot.st-sched { background: var(--blue); }
.st-dot.st-wait { background: var(--orange); }
.st-dot.st-err { background: #D92D20; }
.ld-cal { display: grid; gap: 6px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ld-cal.month { gap: 4px; }
.ld-mh { text-align: center; font-size: 12px; font-weight: 500; color: #8A94A6; padding: 4px 0; }
.ld-day { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; min-width: 0; }
.ld-cal.week .ld-day { min-height: 320px; }
.ld-cal.month .ld-day { min-height: 110px; }
.ld-day:hover { border-color: #BFD4FF; }
.ld-day.today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.ld-day.out { opacity: .45; }
.ld-dn { font-size: 12px; color: #8A94A6; display: flex; flex-direction: column; }
.ld-dn b { font: 800 20px Nunito, sans-serif; color: var(--head); }
.ld-cal.month .ld-dn { font-weight: 500; color: var(--head); }
.ld-pc { display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; background: #F8FAFD; border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 12px; color: var(--head); cursor: pointer; }
.ld-pc:hover { border-color: var(--blue); }
.ld-pc-img { display: block; aspect-ratio: 3/4; border-radius: 6px; overflow: hidden; background: #EEF1F6; }
.ld-cal.month .ld-pc-img, .ld-col .ld-pc-img { aspect-ratio: 16/9; }
.ld-pc-img img { width: 100%; height: 100%; object-fit: cover; }
.ld-pc-row { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.ld-pc-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link.more { font-size: 12px; text-align: left; }
.ld-bych { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.ld-col { display: flex; flex-direction: column; gap: 8px; }

/* Trang soạn bài */
/* Ô soạn cần ≥ 480px: không đủ chỗ cho cả Xem trước thì Xem trước tự xuống dưới (đo theo chỗ trống thật, kể cả khi menu con / bảng Hướng dẫn đang mở) */
.compose { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; padding-bottom: 80px; }
.cp-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; flex: 999 1 480px; }
.cp-side { position: sticky; top: 60px; flex: 1 1 320px; min-width: 0; }
.cp-sec { display: flex; flex-direction: column; gap: 10px; }
.cp-sec > b { color: var(--head); }
.cp-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.cp-row.between { justify-content: space-between; }
.cp-row b { color: var(--head); }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; color: var(--head); }
.radio input { accent-color: var(--blue); width: 16px; height: 16px; }
.ch-opt.on { border-color: var(--blue); background: var(--soft); }
.compose textarea, .compose input:not([type=checkbox]):not([type=radio]), .compose select { font: 14px/1.5 Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 8px; padding: 9px 10px; color: var(--head); background: #fff; width: 100%; }
.compose textarea { resize: vertical; }
.compose .dt { max-width: 260px; }
.cp-ai { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-ai .chip { font-size: 13px; color: #7C3AED; border-color: #DDD6FE; }
.cp-tools { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.tool { border: 1px solid var(--line); background: #F7F8FB; border-radius: 7px; width: 34px; height: 34px; font-size: 15px; }
.tool.aa { font: 700 13px Nunito, sans-serif; background: linear-gradient(135deg, #FDE68A, #FBCFE8, #BFDBFE); color: var(--head); }
.tool.aa.on { color: #fff; }
.ai-btn { color: #7C3AED; border-color: #DDD6FE; }
.bg-grid { display: grid; grid-template-columns: repeat(4, 44px); gap: 6px; padding: 4px 6px; }
.bg-grid button { height: 44px; border-radius: 8px; border: 1px solid var(--line); color: #fff; font: 700 13px Nunito, sans-serif; }
.bg-grid button:first-child { color: #8A94A6; }
.pv-text.bg { min-height: 220px; display: grid; place-items: center; text-align: center; color: #fff; font: 800 20px/1.4 Nunito, sans-serif; padding: 24px 16px; margin: 0 0 2px; }
.role { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px 12px; margin-bottom: 8px; }
.role.on { border-color: var(--blue); background: var(--soft); }
.role b { color: var(--head); }
.ai-out { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.ai-out p { white-space: pre-wrap; color: var(--head); margin: 6px 0; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 2px dashed #D5DCE8; border-radius: 12px; padding: 22px 12px; background: #FAFBFD; width: 100%; font-size: 24px; color: #8A94A6; cursor: pointer; }
.drop b { font-size: 14px; color: var(--head); }
.drop small { font-size: 12px; }
/* Trang soạn có thanh nút dưới cùng: đẩy bảng/nút Hướng dẫn lên trên thanh đó để không che nút lưu */
body:has(.cp-foot) .guide-pill, body:has(.cp-foot) .guide { bottom: 84px; }
.drop.over, .drop:hover { border-color: var(--blue); background: var(--soft); }
.drop-src { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.mg { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #EEF1F6; border: 1px solid var(--line); }
.mg img { width: 100%; height: 100%; object-fit: cover; }
.mg .mt-ph small { display: block; font-size: 10px; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 86px; }
.mg .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(15,23,42,.65); color: #fff; font-size: 12px; }
.media-grid.pick .mg { cursor: pointer; }
.media-grid.pick input { position: absolute; top: 6px; left: 6px; z-index: 1; width: 18px; height: 18px; }
.opt-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; cursor: pointer; }
.opt-row > span:first-child { display: flex; flex-direction: column; color: var(--head); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 11px; background: #CBD5E1; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::after { left: 21px; }
.switch input:focus-visible + i { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch-l { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.cp-foot { position: fixed; left: 68px; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(15,23,42,.06); display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
.app.has-sub .cp-foot { left: 278px; }
.errwrap { position: relative; }
.err-badge { border: 0; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500; color: #fff; }
.err-badge.bad { background: #D92D20; }
.err-badge.warn { background: var(--orange); }
.err-badge.ok { background: #E7F7EE; color: #138A4B; }
.err-panel { position: absolute; bottom: calc(100% + 10px); left: 0; width: min(380px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.2); padding: 12px; }
.err-panel .e { background: #FEECEB; color: #B42318; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.err-panel .w { background: #FFF7ED; color: #9A3412; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.err-panel p { margin: 4px 0 0; font-size: 13px; }

/* Khung xem trước bài */
.pv-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.pv-net { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.pv-net small { color: #8A94A6; }
.pv-head { display: flex; gap: 10px; align-items: center; padding: 10px 12px; }
.pv-head > div { display: flex; flex-direction: column; }
.pv-head b { color: var(--head); font-size: 14px; }
.pv-head small { color: #8A94A6; font-size: 12px; }
.pv-ava { width: 36px; height: 36px; border-radius: 50%; background: #C62828; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.pv-title { margin: 0 12px 6px; font: 800 16px Nunito, sans-serif; color: var(--head); }
.pv-text { padding: 0 12px 10px; white-space: pre-wrap; color: var(--head); font-size: 14px; overflow-wrap: anywhere; }
.pv-media { display: grid; gap: 2px; position: relative; }
.pv-media.n1 { grid-template-columns: 1fr; }
.pv-media.n2, .pv-media.n4 { grid-template-columns: 1fr 1fr; }
.pv-media.n3 { grid-template-columns: 1fr 1fr 1fr; }
.pv-media img, .pv-media .mt-ph { width: 100%; aspect-ratio: 1; object-fit: cover; background: #EEF1F6; }
.pv-media.n1 img { aspect-ratio: auto; max-height: 420px; }
.pv-media.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.pv-media.carousel > * { flex: 0 0 78%; scroll-snap-align: start; }
.pv-more { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-style: normal; border-radius: 6px; padding: 2px 8px; }
.pv-acts { display: flex; justify-content: space-around; padding: 8px; border-top: 1px solid var(--line); color: #8A94A6; font-size: 13px; }
.pv-cmt { margin: 0 12px 8px; background: #F3F4F6; border-radius: 12px; padding: 6px 10px; font-size: 13px; }
.pv-cmt b { color: var(--head); }

/* Bảng tin thêm */
.tp-img { display: block; height: 90px; border-radius: 8px; overflow: hidden; margin-bottom: 4px; }
.tp-img img { width: 100%; height: 100%; object-fit: cover; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.guide-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 12px; }
.guide-card b { color: var(--head); }
.guide-card:hover { border-color: var(--blue); }
.video-row { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 6px 0; color: var(--head); }
.vthumb { position: relative; width: 96px; height: 56px; border-radius: 8px; background: linear-gradient(135deg, #1F3466, #0066FF); color: #fff; display: grid; place-items: center; flex: none; }
.vthumb small { position: absolute; right: 4px; bottom: 2px; font-size: 10px; }
.vplayer { aspect-ratio: 16/9; border-radius: 10px; background: linear-gradient(135deg, #1F3466, #0066FF); color: #fff; display: grid; place-items: center; font-size: 40px; margin-bottom: 12px; text-align: center; }
.vplayer small { display: block; font-size: 13px; }
.support { display: flex; flex-direction: column; gap: 8px; }
.support .btn { text-align: left; }
.steps { padding-left: 20px; }
.steps li { margin: 4px 0; color: var(--head); }

@media (max-width: 1100px) { .cp-side { position: static; } }
@media (max-width: 768px) {
  .cp-foot, .app.has-sub .cp-foot { left: 0; }
  .ld-cal.week { grid-template-columns: repeat(7, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 6px; }
  .pager { margin-left: 0; }
}
@media (max-width: 560px) {
  /* Điện thoại: mọi nút bấm cao ít nhất 40px cho dễ chạm */
  .btn, .btn-sm, .chip, .tab, .pill, .seg button, .sel-sm, .icon-btn, .link-row, .pop-item, .err-badge, .tool, .ld-pc, .guide-card, .video-row, .convo, .sub-link, .sub-group-head, .goto input, .ld-search, .compose select, .compose input:not([type=checkbox]):not([type=radio]), .f-field input, .f-field select, .reply select, .reply-row input, .product, .rail-btn { min-height: 40px; }
  .icon-btn, .tool, .star, .rail-btn { min-width: 40px; }
  .hamburger, .send, .chip .x, .guide-head button, .modal-head .icon-btn { min-width: 40px; min-height: 40px; }
  .chip-list .chip { padding-right: 2px; }
  .avatar { width: 40px; height: 40px; }
  .guide-pill { min-height: 44px; }
  .ld-search input { min-height: 40px; }
  .dr-sel, .pop-range input, .pop select { min-height: 40px; }
  .star { min-height: 40px; font-size: 18px; }
  .link { min-height: 40px; display: inline-flex; align-items: center; }
  .ld-search { flex: 1 1 100%; }
  .ld-search input { width: 100%; }
  .ld-cal.month .ld-day { min-height: 64px; padding: 3px; }
  .ld-cal.month .ld-pc { padding: 0; border: 0; background: none; }
  .ld-cal.month .ld-pc-img, .ld-cal.month .ld-pc-txt, .ld-cal.month .ld-pc-row:last-child { display: none; }
  .ld-cal.month .ld-mh { font-size: 10px; }
  .cp-foot { flex-wrap: wrap; padding: 8px 12px; }
  .cp-foot .btn { flex: 1 1 30%; padding: 6px 4px; font-size: 12px; white-space: normal; }
  .cp-foot .grow { display: none; }
  .errwrap { flex-basis: 100%; }
  body:has(.cp-foot) .guide-pill, body:has(.cp-foot) .guide { display: none; } /* trang soạn trên điện thoại: thanh nút lưu đã chiếm đáy màn hình */
  .drawer.left { width: 88vw; }
}

/* ===== Vòng 2b: Chiến dịch, Khám phá, Giao việc theo mẫu ===== */
.btn-green { background: #14B8A6; color: #fff; }
.crm-gate { min-height: calc(100vh - 140px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.crm-logo { width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #E0E7FF, #C7D2FE); color: var(--blue); display: grid; place-items: center; }
.crm-logo svg { width: 40px; height: 40px; }
.crm-gate h2 { font-size: 26px; font-weight: 800; }
.crm-gate h2 span { color: var(--blue); }
.crm-gate p { margin: 0 0 8px; }
.ld-bar .btn:disabled { opacity: .45; cursor: not-allowed; }
.nomg { margin: 0; }
.pop-group { padding: 4px 8px; border-top: 1px solid var(--line); }
.pop-group > b { display: block; font-size: 12px; color: #8A94A6; margin: 6px 0 2px; }
.ch-pick.col { flex-direction: column; align-items: stretch; max-height: 220px; overflow-y: auto; }
.upl { align-self: flex-start; cursor: pointer; }
#wh-vars { display: flex; flex-direction: column; gap: 8px; }
#wh-vars textarea { font: 14px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 8px; padding: 8px 10px; resize: vertical; }
.empty-ufo { text-align: center; padding: 60px 12px; }
.ufo { font-size: 56px; }
.cp-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cd-pick > .f-field { min-width: 240px; }
.cd-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.cd-day { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 0; }
.cd-day > b { background: #14B8A6; color: #fff; border-radius: 6px; text-align: center; font-size: 12px; padding: 6px 2px; }
.cd-t { display: flex; align-items: center; gap: 2px; }
.cd-t input { width: 100%; min-width: 0; font: 12px Roboto, sans-serif; border: 1px solid #D5DCE8; border-radius: 6px; padding: 4px; }
.cd-t .x { border: 0; background: none; color: #8A94A6; }
.cd-add { border: 1px dashed #99F6E4; background: #F0FDFA; color: #0F766E; border-radius: 6px; font-size: 18px; min-height: 34px; }
.tr-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #1F3466; color: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.tr-net { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin-right: auto; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.tr-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.tr-card .pv-head { padding: 0; }
.tr-text { margin: 0; color: var(--head); white-space: pre-wrap; }
.tr-img { aspect-ratio: 4/3; border-radius: 10px; display: grid; place-items: center; font-size: 56px; background: linear-gradient(135deg, #FDE68A, #FBCFE8, #BFDBFE); }
.tr-stats { display: flex; gap: 14px; font-size: 13px; color: var(--text); }
.fp-bar { display: flex; gap: 8px; background: #1F3466; border-radius: 12px; padding: 8px; margin-bottom: 12px; }
.fp-bar button { border: 0; border-radius: 8px; padding: 8px 12px; background: rgba(255,255,255,.12); color: #fff; font-weight: 500; font-size: 13px; }
.fp-bar button.on { background: #fff; color: var(--navy); }
.fp-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: start; }
.fp-list { background: #fff; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-height: 260px; }
.fp-add { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 20px 8px; color: var(--head); font-weight: 500; margin-top: auto; }
.fp-add span { width: 44px; height: 44px; border-radius: 50%; background: #EC4899; color: #fff; display: grid; place-items: center; font-size: 22px; }
.fp-main { min-width: 0; }
button.task { width: 100%; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; cursor: pointer; }
.task .tag { align-self: flex-start; margin-top: 4px; }
.kb { margin-bottom: 8px; } .kb .task { margin-bottom: 4px; }
.ld-cal .task { padding: 6px 8px; margin: 0; font-size: 12px; }
.tpl-head { background: #2E1065; border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.tpl-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tpl-cat { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 4px; min-height: 80px; border: 2px solid transparent; border-radius: 12px; padding: 10px; color: #fff; font-weight: 500; text-align: left; background: linear-gradient(135deg, #7C3AED, #DB2777); }
.tpl-cat span { font-size: 26px; }
.tpl-cat.on { border-color: #F472B6; box-shadow: 0 0 0 3px rgba(244,114,182,.4); }
.tpl-months { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.tpl-months .chip { background: transparent; color: #E9D5FF; border-color: #7C3AED; }
.tpl-months .chip.on { background: #EC4899; border-color: #EC4899; color: #fff; }
.tpl-head .ld-bar { margin: 0; }
.tpl-head .cal-nav b { color: #fff; }
.tpl-cal .ld-day { cursor: default; }
.ld-pad { display: none; }
@media (min-width: 561px) { .ld-pad { display: block; } }
.tpl-item { background: #F5F3FF; color: #5B21B6; border-radius: 6px; padding: 4px 6px; font-size: 12px; }
@media (max-width: 768px) {
  .fp-wrap { grid-template-columns: 1fr; }
  .fp-list { min-height: 0; }
  .tpl-cats { grid-template-columns: repeat(5, 150px); overflow-x: auto; }
  .cd-week { grid-template-columns: repeat(7, 110px); overflow-x: auto; }
}
@media (max-width: 560px) {
  .cd-add, .cd-t input, .cd-t .x, .tpl-cat, .fp-bar button, .fp-add, button.task { min-height: 40px; }
  .cd-t .x { min-width: 40px; }
  .tr-bar .sel-sm { flex: 1 1 45%; }
}

/* ===== Vòng 3: mượt 100% ===== */
.btn-red { background: #D92D20; color: #fff; }
.ask-msg { color: var(--head); margin: 0; }
.btn[aria-disabled="true"] { opacity: .5; } /* nút lưu "mờ" nhưng vẫn bấm được để hiện danh sách lỗi */
.cp-tools { flex-wrap: wrap; }
.cp-tools .grow { min-width: 8px; }
/* Bảng Hướng dẫn đang mở: màn rộng chừa lề phải, màn hẹp chừa đáy — không nút nào bị đè */
@media (min-width: 1440px) { body:has(#guide:not([hidden])) .content { padding-right: 340px; } }
@media (max-width: 1439px) { body:has(#guide:not([hidden])) .content { padding-bottom: 460px; } }
@media (max-width: 560px) {
  /* Điện thoại: mọi thứ bấm được rộng và cao ít nhất 40px */
  button, select, .link, a.link, .ask input, input[type=time], input[type=date], input[type=datetime-local], input[type=number] { min-height: 40px; }
  button, select, .link, a.link { min-width: 40px; }
  input[type=checkbox]:not(.switch > input), input[type=radio] {
    appearance: none; -webkit-appearance: none; width: 40px; height: 40px; min-width: 40px; margin: 0; flex: none; cursor: pointer;
    background: center / 22px 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Crect x='1' y='1' width='20' height='20' rx='4' fill='white' stroke='%23A0A9BA' stroke-width='2'/%3E%3C/svg%3E");
  }
  input[type=checkbox]:not(.switch > input):checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Crect x='1' y='1' width='20' height='20' rx='4' fill='%230066FF'/%3E%3Cpath d='M6 11.5l3.2 3.2L16 8' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
  input[type=radio] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='10' fill='white' stroke='%23A0A9BA' stroke-width='2'/%3E%3C/svg%3E"); }
  input[type=radio]:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='10' fill='white' stroke='%230066FF' stroke-width='2'/%3E%3Ccircle cx='11' cy='11' r='5' fill='%230066FF'/%3E%3C/svg%3E"); }
  input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--blue); outline-offset: -6px; }
  .switch { width: 48px; height: 40px; }
  .switch i { top: 9px; bottom: 9px; }
  .switch input:checked + i::after { left: 29px; }
  .ld-table .ck { width: 48px; }
  .fp-opt input, .ld-table input[type=checkbox] { width: 40px; height: 40px; }
  .media-grid.pick input { top: 0; left: 0; }
  .ch-opt, .radio { padding-top: 0; padding-bottom: 0; }
}

/* ===== Vòng 4: điện thoại — ô soạn chiếm ≥ 90% bề ngang màn ===== */
@media (max-width: 560px) {
  body:has(#compose) .content { padding-left: 8px; padding-right: 8px; }
  .compose .cp-sec { padding-left: 8px; padding-right: 8px; }
}

/* ---- Trang Facebook thật (fb.js) ---- */
.fb-card { margin-bottom: 16px; }
.fb-off { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fb-page { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.fb-page img { border-radius: 50%; }
.fb-page > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; color: var(--head); }
.fb-sub { margin: 14px 0 8px; color: var(--head); font-size: 13px; }
.fb-top { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.fb-post { display: flex; flex-direction: column; gap: 4px; text-align: left; background: #F7F8FB; border: 0; border-radius: 10px; padding: 8px; color: var(--head); min-width: 0; }
.fb-post img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; }
.fb-txt { overflow-wrap: anywhere; }
.fb-wrap { white-space: normal; min-width: 200px; }
.fb-err { color: #B42318; font-size: 12px; margin: 4px 0; }
.fb-stats { margin-top: 12px; }
.fb-steps { padding-left: 20px; } .fb-steps li { margin-bottom: 6px; }
.fb-pre { background: #0F172A; color: #E2E8F0; padding: 10px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-cmt { border-bottom: 1px solid var(--line); padding: 8px 0; } .fb-cmt p { margin: 2px 0 4px; color: var(--head); }
.fb-nets { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fb-net { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.fb-net > .net-dot { flex-shrink: 0; }
.fb-net > span:not(.net-dot) { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--head); }
.fb-explain h4 { margin: 12px 0 4px; color: var(--head); } .fb-explain p { margin: 0 0 6px; }
.fb-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0; cursor: pointer; }
.fb-opt:has(input:checked) { border-color: var(--blue); background: var(--soft); }
.fb-opt span { display: flex; flex-direction: column; color: var(--head); } .fb-opt small { color: #64748B; }
.fb-meta { margin: 8px 0; font-size: 12px; }

/* ---- Trợ lý số liệu (tro-ly.js) ---- */
.tl-ans { max-width: min(860px, 100%); margin: 14px auto 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-align: left; box-shadow: 0 4px 16px rgba(15,23,42,.06); }
.tl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--head); margin-bottom: 6px; }
.tl-title { font-size: 16px; margin: 8px 0 6px; }
.tl-lines { margin: 6px 0; padding-left: 20px; color: var(--head); } .tl-lines li { margin: 4px 0; overflow-wrap: anywhere; }
.tl-draft { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.tl-meta { font-size: 13px; color: var(--head); margin-bottom: 6px; }
.tl-text { white-space: pre-wrap; overflow-wrap: anywhere; background: #F7F8FB; border-radius: 10px; padding: 10px 12px; font: 13px/1.55 Roboto, sans-serif; color: var(--head); margin: 0 0 8px; }

/* Công cụ hình ảnh chạy trên máy (anh.js) */
.anh-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.anh-kq { display: flex; flex-direction: column; gap: 8px; }
.anh-cap { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.anh-cap figure { margin: 0; border-radius: 10px; background: #F3F4F6; min-height: 140px; display: grid; place-items: center; overflow: hidden; position: relative; }
.anh-cap figure.checker { background: repeating-conic-gradient(#E5E7EB 0 25%, #fff 0 50%) 0 0/20px 20px; }
.anh-cap img { width: 100%; max-height: 300px; object-fit: contain; display: block; }
.anh-cap figcaption { position: absolute; left: 6px; top: 6px; background: rgba(17, 24, 39, .72); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.anh-tien { height: 8px; border-radius: 99px; background: #E5E7EB; overflow: hidden; }
.anh-tien i { display: block; height: 100%; background: #2563EB; transition: width .4s; }
.anh-ok { margin: 0; color: #047857; font-size: 13px; }
.anh-nut { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.anh-ve { position: relative; max-width: 100%; margin-bottom: 8px; touch-action: none; }
.anh-ve canvas { display: block; width: 100%; height: auto; border-radius: 8px; }
.anh-ve #anh-to { position: absolute; inset: 0; opacity: .5; cursor: crosshair; }
.anh-co { align-items: end; }
/* Công cụ video chạy trên máy (video.js) */
.v-cap video { width: 100%; max-height: 360px; display: block; background: #111827; }
.v-cues { display: grid; gap: 6px; max-height: 360px; overflow: auto; padding-right: 4px; }
.v-cue { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: center; }
.v-cue small { color: #6B7280; font-variant-numeric: tabular-nums; }
.v-cue input { min-height: 40px; }
@media (max-width: 560px) { .v-cue { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Kết nối kênh / Nhóm kênh (kenh.js) ---------- */
.kn-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 12px; overflow-x: auto; }
.kn-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; min-height: 40px; color: var(--text); font-weight: 500; white-space: nowrap; }
.kn-tab.on { color: var(--blue); border-bottom-color: var(--blue); }
.kn-tabs.sm { margin: 0 0 8px; } .kn-tabs.sm .kn-tab { padding: 6px 10px; }
.kn-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kn-count { color: var(--head); }
.kn-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kn-search { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #D5DCE8; border-radius: var(--btn-r); padding: 0 10px; background: #fff; min-height: 36px; }
.kn-search input { border: 0; outline: 0; font: inherit; width: 150px; min-width: 0; background: transparent; }
.kn-search:focus-within { border-color: var(--blue); }
.kn-bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--soft); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; color: var(--head); }
.kn-all { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.kn-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kn-row.err { background: #FFF8F7; }
.kn-row input[type=checkbox], .kn-all input { width: 18px; height: 18px; flex: none; margin: 0; }
.kn-ck { display: grid; place-items: center; min-width: 40px; min-height: 40px; margin: -8px 0 -8px -10px; cursor: pointer; flex: none; }
.kn-all { min-height: 40px; }
.kn-no { color: #8A94A6; font-size: 13px; min-width: 20px; }
.kn-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--head); overflow-wrap: anywhere; }
.kn-alias { color: var(--blue); } .kn-note { color: #8A5A00; }
.kn-gs, .kn-gchs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.kn-g { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; background: #F1F5F9; border-radius: 999px; padding: 2px 9px 2px 4px; color: var(--head); }
.kn-g i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 4px; }
.kn-g .net-dot { width: 18px; height: 18px; font-size: 10px; }
.kn-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.kn-more { font-size: 18px; min-width: 40px; min-height: 40px; }
.kn-empty { text-align: center; padding: 24px 8px; } .kn-empty h3 { margin-bottom: 6px; }
/* Thêm kênh */
.kn-nets { display: flex; flex-direction: column; gap: 8px; }
.kn-net { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #FAFBFD; }
.kn-net-top { display: grid; grid-template-columns: auto minmax(130px, 1fr) minmax(0, 1.6fr) auto; gap: 10px; align-items: center; }
.kn-net-top > .net-dot { width: 36px; height: 36px; font-size: 15px; }
.kn-net-name { display: flex; flex-direction: column; color: var(--head); }
.kn-badge { align-self: flex-start; font-size: 11px; background: #FFF1E6; color: #C2410C; border-radius: 6px; padding: 0 6px; }
.kn-feats small { display: block; font-weight: 600; color: var(--head); }
.kn-feats span { display: flex; flex-wrap: wrap; gap: 4px; }
.kn-feats i, .kn-chip { font-style: normal; font-size: 12px; background: #EEF1F6; border-radius: 5px; padding: 1px 7px; color: var(--head); }
.kn-chip { margin-right: 4px; }
.kn-net-act { display: flex; gap: 6px; align-items: center; }
.kn-net-act .icon-btn { min-width: 40px; min-height: 40px; }
.kn-warn { color: #C2410C; font-size: 12px; margin: 8px 0 0 46px; }
.kn-net-more { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; font-size: 13px; color: var(--head); }
.kn-net-more ul { list-style: none; margin: 6px 0 0; padding: 0; } .kn-net-more p { margin: 6px 0 0; }
/* Sắp xếp + website */
.kn-sort { display: flex; flex-direction: column; gap: 6px; }
.kn-sort-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.kn-sort-row span:not(.net-dot) { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--head); }
.kn-sort-row input { width: 70px; text-align: center; font: inherit; border: 1px solid #D5DCE8; border-radius: 7px; padding: 6px; }
.kn-site:has(input[value=blogger]:checked) .kn-cred { display: none; }
.kn-help { font-size: 13px; margin-bottom: 8px; } .kn-help summary { color: var(--blue); cursor: pointer; padding: 6px 0; }
/* Nhóm kênh */
.kn-imp { position: relative; }
.kn-gtable { display: flex; flex-direction: column; }
.kn-gh, .kn-gr { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kn-gh { font-weight: 600; color: var(--head); font-size: 13px; } .kn-gh span:last-child { grid-column: 2 / 4; }
.kn-gname { display: flex; align-items: center; gap: 8px; color: var(--head); } .kn-gname i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.kn-gact { display: flex; gap: 6px; }
.kn-ge { display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: 16px; padding: 12px; margin: 8px 0; background: var(--soft); border-radius: 12px; }
.kn-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.kn-color { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px #D5DCE8; cursor: pointer; position: relative; }
.kn-color input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.kn-color:has(input:checked) { box-shadow: 0 0 0 2px var(--head); }
.kn-color:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.kn-picked { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.kn-ge-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
@media (max-width: 760px) {
  .kn-net-top { grid-template-columns: auto 1fr auto; }
  .kn-feats { grid-column: 1 / -1; }
  .kn-warn { margin-left: 0; }
  .kn-net-more, .kn-ge { grid-template-columns: 1fr; }
  .kn-gh { display: none; }
  .kn-gr { grid-template-columns: 1fr; gap: 6px; }
  .kn-search { flex: 1 1 100%; } .kn-search input { width: 100%; }
  .kn-tools .btn { min-height: 40px; }
  .kn-row { flex-wrap: wrap; }
  .kn-side { order: 5; flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding-left: 28px; text-align: left; }
}
.ig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 10px 0 6px; }
.ig-cell { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #F1F5F9; color: #fff; text-decoration: none; }
.ig-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-cell span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 12px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.yt-cell { aspect-ratio: 16 / 9; }
.tk-btn { margin-left: auto; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-links a { color: var(--blue); }
@media (max-width: 560px) { .tk-btn { max-width: 110px; padding: 6px 8px; font-size: 12px; } }
.tk-btn + .grid-btn { margin-left: 0; }
