:root {
  --blue: #1a3a8f; --blue-2: #2a52be; --gold: #c9a227; --cream: #fff8e7; --ink: #1d2433; --muted: #667085;
  --line: #e4e7ec; --bg: #f5f6fa; --red: #c0392b; --green: #1e8e5a;
  --k-post: #2a52be; --k-ad: #c0392b; --k-zoom: #1e8e5a; --k-event: #8e44ad; --k-sale: #c9a227; --k-other: #667085;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue-2); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--blue); color: #fff; padding: 10px 16px; border-bottom: 3px solid var(--gold); }
.brand { color: #fff; font-weight: 700; text-decoration: none; }
.logout { display: flex; gap: 8px; align-items: center; margin: 0; }
.who { opacity: .85; font-size: 14px; }
button.link { background: none; border: 0; color: var(--cream); text-decoration: underline; cursor: pointer; font: inherit; }
.nav { display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 8px; }
.nav a { padding: 12px 14px; text-decoration: none; color: var(--ink); white-space: nowrap; border-bottom: 3px solid transparent; }
.nav a.on { border-color: var(--gold); color: var(--blue); font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 8px 0 12px; color: var(--blue); }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 14px 0 8px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.narrow, section.narrow { max-width: 560px; }
.card.warn { border-color: var(--red); }
.flash { background: #e8f6ee; border: 1px solid var(--green); color: #135c3a; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.error { background: #fdecea; border: 1px solid var(--red); color: #8a1f14; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.hint, .muted { color: var(--muted); font-size: 14px; }
.warn-text { color: var(--red); font-weight: 600; }
label { display: block; margin: 10px 0; font-weight: 600; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; border: 1px solid #c8ccd4; border-radius: 8px; background: #fff; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 6px 0 0; transform: scale(1.3); }
fieldset { border: 0; padding: 0; margin: 10px 0; }
legend { font-weight: 600; margin-bottom: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: inline-flex; align-items: center; font-weight: 500; margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; }
.choice.block { display: flex; border-radius: 8px; margin: 6px 0; }
.btn, button { display: inline-block; padding: 9px 14px; border-radius: 8px; border: 1px solid #c8ccd4; background: #fff; color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; }
.btn.primary, button.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.small, button.small { padding: 5px 10px; font-size: 14px; }
.big { padding: 12px 22px; font-size: 17px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 16px; }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.bar .quick { margin: 0; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 8px 0 0; flex-wrap: wrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list .row, .care .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list .row:last-child { border-bottom: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.hot td { background: #fff4f2; }
.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-block; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.stage { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--cream); border: 1px solid var(--gold); font-size: 13px; }
.stage.st-member { background: #e8f6ee; border-color: var(--green); }
.stage.st-paused { background: #eee; border-color: #bbb; }
.tag { font-size: 12px; background: var(--cream); border: 1px solid var(--gold); border-radius: 6px; padding: 0 6px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.checklist { list-style: none; padding: 0; columns: 2; }
.checklist li label { font-weight: 500; padding: 6px 0; margin: 0; }
.cares { list-style: none; padding: 0; }
.care { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; }
.care .reason { font-weight: 600; color: var(--red); }
.care form input[name=other] { max-width: 420px; }
/* Lịch */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { text-align: center; font-weight: 600; color: var(--muted); font-size: 14px; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 110px; padding: 4px; }
.day.out { opacity: .5; }
.day.today { border: 2px solid var(--gold); }
.dayhead { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.dayhead .add { text-decoration: none; font-weight: 700; padding: 0 6px; border-radius: 6px; }
.dayhead .add:hover { background: var(--cream); }
.item { display: block; font-size: 13px; padding: 3px 6px; margin-top: 3px; border-radius: 6px; text-decoration: none; color: var(--ink); border-left: 4px solid var(--k-other); background: #f7f8fb; }
.item small { display: block; color: var(--muted); }
.item .t { font-weight: 600; }
.item.st-done { text-decoration: line-through; opacity: .6; }
.item.st-idea, .item.st-drafting { border-style: dashed; }
.kind-post { border-left-color: var(--k-post); } .kind-ad { border-left-color: var(--k-ad); } .kind-zoom { border-left-color: var(--k-zoom); }
.kind-event { border-left-color: var(--k-event); } .kind-sale { border-left-color: var(--k-sale); } .kind-other { border-left-color: var(--k-other); }
.list .row[class*=kind-] { border-left-width: 4px; border-left-style: solid; padding-left: 8px; }
.chip[class*=kind-] { border-left-width: 4px; }
.choice[class*=kind-] { border-left-width: 4px; }
.mobile-only { display: none; }
@media (max-width: 760px) {
  main { padding: 10px; }
  .cols, .two { grid-template-columns: 1fr; }
  .checklist { columns: 1; }
  .cal { grid-template-columns: 1fr; }
  .wd, .day.empty { display: none; }
  .day { min-height: 0; }
  .mobile-only { display: block; }
  .table { font-size: 14px; }
  .kv { grid-template-columns: 120px 1fr; }
}

/* Mảng TT/MKT/QC/BH và bảng số */
.pillar { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 4px; border-radius: 4px; background: var(--gold, #c9a227); color: #1a1a1a; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.fix-source { margin: 8px 0 12px; }
.fix-source summary { cursor: pointer; color: var(--blue, #1a3a8f); font-weight: 600; }


/* Bảng phễu khách */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.fcol { flex: 0 0 230px; background: #eef1f7; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.fcol h2 { font-size: 15px; margin: 0 0 4px; display: flex; justify-content: space-between; align-items: center; }
.fcol .count { font-weight: 700; color: var(--blue); }
.fcol ul { list-style: none; margin: 8px 0 0; padding: 0; min-height: 40px; }
.fcol.over { outline: 3px dashed var(--gold); }
.fcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; font-size: 14px; }
.fcard[draggable="true"] { cursor: grab; }
.fcard.stale { border: 2px solid var(--red); }
.fcard form { margin: 6px 0 0; }
.btn.small, button.small { padding: 4px 10px; font-size: 13px; margin-top: 6px; }
.frates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fstep { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; min-width: 92px; }
.fstep b { font-size: 20px; color: var(--blue); }
.farrow { color: var(--muted); }
.fweak { background: var(--cream); border: 1px solid var(--gold); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
/* Gói "Không sót khách": hẹn tiếp theo, thẻ màu, bộ lọc */
.next { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 6px; background: #eef1f7; border: 1px solid var(--line); }
.next.now { background: #fff4d6; border-color: var(--gold); font-weight: 600; }
.next.late { background: #fdecea; border-color: var(--red); color: #8a1f14; font-weight: 600; }
.nextnow { padding: 8px 12px; border-radius: 8px; background: #eef1f7; margin: 0 0 8px; }
.nextnow.late { background: #fdecea; color: #8a1f14; }
.ctag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; color: #fff; vertical-align: middle; }
.tg1 { background: #2a52be; } .tg2 { background: #1e8e5a; } .tg3 { background: #9a7b10; } .tg4 { background: #c0392b; } .tg5 { background: #8e44ad; } .tg6 { background: #667085; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 12px; }
.tagrow form.inline { display: inline-flex; align-items: center; gap: 2px; margin: 0; }
.tagrow button.x { padding: 0 6px; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.addtag summary { cursor: pointer; color: var(--blue-2); font-size: 14px; }
.addtag form { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 6px; max-width: 520px; }
.filterbox { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
.filterbox label { font-size: 14px; }
@media (max-width: 760px) { .filterbox { grid-template-columns: 1fr 1fr; } }
.filterform input[name=q] { margin: 0 0 4px; }
.filterform .actions { margin-top: 4px; }

/* Gói "Dữ liệu vào/ra" */
.steps li { margin-bottom: 12px; }
.mapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.mapgrid label { font-size: 14px; }
.scroll { overflow-x: auto; }
.pre { white-space: pre-line; font-size: 13px; max-width: 320px; }
.ok { color: var(--green); font-weight: 600; }
.bad { color: var(--red); font-weight: 600; }
.big-list li { margin: 6px 0; }
details.danger summary { cursor: pointer; color: var(--red); font-size: 14px; }
details.danger.card summary { font-weight: 600; }
button.danger-btn, .danger-btn { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
form.inline { display: inline; }

/* Gói "Đăng ký, chuyển khoản, câu mẫu" */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; }
.stat span { color: var(--muted); font-size: 14px; } .stat b { font-size: 20px; color: var(--blue); }
.stat.warn b { color: var(--red); }
@media (max-width: 600px) { .stats { grid-template-columns: 1fr; } }
.reg { display: block !important; }
.regst { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); background: #eef1f7; }
.regst.st-new { background: #fdecea; border-color: var(--red); color: #8a1f14; }
.regst.st-paid { background: #e8f6ee; border-color: var(--green); color: #135c3a; }
.regst.st-cancelled { text-decoration: line-through; }
.payform { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 6px; }
.payform label { margin: 0; flex: 1 1 180px; } .payform input { margin: 0; } .table .payform input { max-width: 130px; }
details.tpl { border-top: 1px solid var(--line); padding: 8px 0; } details.tpl summary { cursor: pointer; font-weight: 600; }
details.tpl textarea { margin: 8px 0; }
.branchgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.branch { border: 1px solid #d6dce8; border-radius: 8px; padding: 8px 12px; margin: 0; }
.branch legend { font-weight: 600; padding: 0 4px; }
/* Ảnh đính kèm của việc kế hoạch (phiếu nội dung và duyệt) */
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.thumb { margin: 0; width: 160px; text-align: center; }
.thumb img { width: 160px; height: 200px; object-fit: contain; background: #f3f4f6; border: 1px solid #ddd; border-radius: 6px; }
.thumb .link { color: #b42318; }
.brief { background: #f7f4ea; border-left: 4px solid #c9a227; padding: 8px 12px; margin: 8px 0; }
.post-preview { white-space: pre-wrap; background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 12px; max-height: 420px; overflow: auto; margin-bottom: 12px; }
/* Bảng nhập của Kế hoạch sự kiện */
.table.edit input { width: 100%; min-width: 0; margin: 0; }
.table.edit input.short { width: 5em; }
.table.edit td { padding: 4px; vertical-align: middle; }
.table.edit input[type=checkbox] { width: auto; transform: scale(1.3); }
@media (max-width: 700px) { .table.edit { display: block; overflow-x: auto; } }
.table.edit textarea.wide { width: 100%; min-width: 14em; margin: 0; resize: vertical; }
.table.edit td:has(textarea.wide) { width: 45%; }
/* Giải ngân ngân sách tháng */
.tag.ok { background: #e8f5ec; border-color: #2e7d4f; color: #1d5c38; }
.tag.warn { background: #fff7e0; border-color: #c99a00; color: #7a5b00; }
.tag.bad { background: #fdecea; border-color: var(--red); color: #8a1f14; font-weight: 600; }
.ok-text { color: #1d5c38; font-weight: 600; }
.warn-list { margin: 6px 0 0; padding-left: 20px; color: #8a1f14; }
.warn-list li { margin-bottom: 4px; }
.table.budget tr.group th { background: var(--cream); text-align: left; }
.table.budget input { width: 9em; text-align: right; }
.btn.warn { border-color: var(--red); color: #8a1f14; font-weight: 600; background: #fdecea; }
/* Bản đồ năm, sổ phản hồi */
.scroll { overflow-x: auto; }
.table.yearmap textarea { width: 100%; min-width: 9em; font-size: 14px; }
.table.yearmap tr.now td { outline: 2px solid var(--gold); }
.table.yearmap tr.demand-cuc_lon td:first-child { border-left: 6px solid #b3261e; }
.table.yearmap tr.demand-lon td:first-child { border-left: 6px solid #e07a1f; }
.table.yearmap tr.demand-cao td:first-child { border-left: 6px solid #c99a00; }
.table.yearmap tr.demand-binh_thuong td:first-child { border-left: 6px solid #2e7d4f; }
.mapline { padding: 10px 14px; }
.table.yearmap select { min-width: 8em; }
