/* Trang Đăng bài nhiều nhóm (/dang-bai) - dùng chung token màu của style.css */
body.page-db { background: #f4f7fb; }
.db-wrap { max-width: 1180px; padding-bottom: 48px; }
.page-db .ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.page-db .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.page-db .muted a, .page-db .db-note a { color: var(--blue); }

/* ---------- Đầu trang ---------- */
.db-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 26px 0 16px; }
.db-hero h1 { margin: 0; font-size: 28px; letter-spacing: -.4px; }
.db-hero p { margin: 4px 0 0; color: var(--muted); }
.db-help { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.db-help:hover { border-color: var(--blue); color: var(--blue); }

.db-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.db-stat { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.db-stat-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.db-stat b { font-size: 26px; line-height: 1.1; }
.db-stat b small { font-size: 15px; color: var(--muted); font-weight: 600; }
.db-stat-sub { font-size: 13px; color: var(--muted); }
.db-stat-sub a { color: var(--blue); }
.db-bar { height: 6px; border-radius: 99px; background: #eaf0f7; overflow: hidden; margin-top: 4px; }
.db-bar span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.db-bar span.hot { background: var(--amber); }

/* ---------- Tabs ---------- */
.db-tabs { display: inline-flex; gap: 4px; padding: 4px; background: #e8eef6; border-radius: 14px; margin-bottom: 16px; max-width: 100%; overflow-x: auto; }
.db-tab { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 9px 16px; border-radius: 11px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.db-tab:hover { color: var(--text); }
.db-tab.active { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(23,33,47,.12); }
.db-count:empty { display: none; }
.db-count { min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-size: 12px; line-height: 20px; text-align: center; }

/* ---------- Thẻ chung ---------- */
.db-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(23,33,47,.04); }
.db-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.db-card-head h3 { margin: 0; font-size: 17px; }
.db-lead { margin: -4px 0 12px; font-size: 14px; }
.db-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.db-empty { text-align: center; padding: 40px 20px; margin-top: 30px; }
.db-empty-mini { color: var(--muted); font-size: 14px; margin: 6px 0; }
.db-empty-mini a { color: var(--blue); }
.db-pill { display: inline-block; padding: 3px 10px; border-radius: 99px; background: #eef2f7; color: var(--muted); font-size: 13px; font-weight: 700; margin: 0; }
.db-pill.on { background: var(--blue); color: #fff; }
.db-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: #eef2f7; color: var(--muted); font-size: 12px; font-weight: 600; margin-left: 6px; }
.db-chip .ic { width: 12px; height: 12px; }
.db-link { border: 0; background: none; color: var(--blue); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.db-link:hover { text-decoration: underline; }
.db-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.db-ghost { color: var(--muted); }
.db-ghost:hover { color: var(--red); border-color: var(--red); }
.db-tip { background: linear-gradient(135deg, #eef5ff, #f5f9ff); border: 1px solid #d6e6ff; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.db-tip a { color: var(--blue); }

/* Nhãn trạng thái có chấm màu */
.db-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; margin-left: 8px; }
.db-tag i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.db-tag.ok { background: var(--green-soft); color: var(--green); }
.db-tag.wait { background: var(--amber-soft); color: var(--amber); }
.db-tag.err { background: var(--red-soft); color: var(--red); }
.db-tag.off { background: #eef2f7; color: var(--muted); }

.db-hint { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; padding: 8px 11px; border-radius: 10px; margin: 8px 0 0; }
.db-hint .ic { margin-top: 1px; }
.db-hint.info { background: #f3f6fa; color: var(--muted); }
.db-hint.warn { background: var(--amber-soft); color: var(--amber); }
.db-hint.err { background: var(--red-soft); color: var(--red); }
.db-warn-mini { display: inline-flex; gap: 6px; align-items: flex-start; color: var(--amber); font-size: 12.5px; margin: 4px 0; }
em.err, .db-summary .err { color: var(--red); font-style: normal; font-weight: 600; }
em.wait, .db-summary .wait { color: var(--amber); font-style: normal; font-weight: 600; }

/* Avatar tròn chữ cái */
.db-ava { width: 30px; height: 30px; flex: none; border-radius: 10px; background: linear-gradient(135deg, #c9d6e8, #a9bad2); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; overflow: hidden; }
.db-ava img { width: 100%; height: 100%; object-fit: cover; }
.db-ava.lg { width: 42px; height: 42px; border-radius: 13px; font-size: 17px; background: linear-gradient(135deg, var(--blue), #3fa2ff); }
.db-ava.me { width: 36px; height: 36px; border-radius: 50%; font-size: 11px; background: linear-gradient(135deg, var(--blue), #3fa2ff); }

/* ---------- Soạn bài ---------- */
.db-compose { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.db-col { min-width: 0; }
.db-sticky { position: sticky; top: 76px; max-height: calc(100vh - 92px); display: flex; flex-direction: column; }
.db-sticky .db-targets { flex: 1; min-height: 120px; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
#bcText { width: 100%; resize: vertical; font: inherit; font-size: 15px; line-height: 1.55; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; min-height: 140px; }
#bcText:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.db-card.drop { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.db-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-top: 12px; }
.db-thumb, .db-add-img { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; }
.db-thumb { background: #eef2f7; display: grid; place-items: center; }
.db-thumb img { width: 100%; height: 100%; object-fit: cover; }
.db-thumb em { position: absolute; left: 6px; bottom: 6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; font-size: 11.5px; font-weight: 700; font-style: normal; display: grid; place-items: center; }
.db-thumb button { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.db-thumb button .ic { width: 13px; height: 13px; }
.db-add-img { border: 1.5px dashed #c5d3e6; background: #f8fbff; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: inherit; font-size: 12.5px; font-weight: 600; }
.db-add-img:hover { border-color: var(--blue); color: var(--blue); }
.db-add-img .ic { width: 22px; height: 22px; }
.db-spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid #cdd8e6; border-top-color: var(--blue); animation: dbspin .8s linear infinite; }
@keyframes dbspin { to { transform: rotate(360deg); } }

/* Xem trước kiểu tin Zalo */
.db-preview { background: #e9eef5; border-radius: 14px; padding: 16px; min-height: 90px; }
.db-preview-empty { color: var(--muted); text-align: center; margin: 18px 0; font-size: 14px; }
.db-msg { display: flex; gap: 10px; align-items: flex-start; }
.db-msg > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 420px; }
.db-bubble { background: #fff; border-radius: 4px 14px 14px 14px; padding: 9px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.5; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.db-bubble-img { padding: 4px; display: grid; gap: 3px; }
.db-bubble-img.n2, .db-bubble-img.n4 { grid-template-columns: 1fr 1fr; }
.db-bubble-img.n3 { grid-template-columns: 1fr 1fr; }
.db-bubble-img.n3 span:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }
.db-bubble-img span { position: relative; display: block; border-radius: 10px; overflow: hidden; aspect-ratio: 1; }
.db-bubble-img.n1 span { aspect-ratio: auto; max-height: 300px; }
.db-bubble-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.db-bubble-img b { position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 22px; display: grid; place-items: center; }
.db-caption { padding: 6px 8px 4px; white-space: pre-wrap; font-size: 14.5px; }

/* Danh sách nhóm dạng hàng gọn */
.db-search { position: relative; margin-bottom: 10px; }
.db-search input { width: 100%; padding-left: 12px; border-radius: 10px; }
.db-acc { padding: 4px 0 10px; }
.db-acc + .db-acc { border-top: 1px solid var(--border); padding-top: 12px; }
.db-acc.off .db-rows { opacity: .65; }
.db-acc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.db-acc-head .db-link { white-space: nowrap; flex: none; }
.db-acc-head > div { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; font-size: 14.5px; }
.db-acc-head .db-tag { margin-left: 6px; }
.db-sub { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 5px; }
.db-rows { display: grid; gap: 4px; }
.db-rows.picked { background: var(--blue-soft); border-radius: 12px; padding: 4px; }
.db-row { position: relative; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; border: 1.5px solid transparent; background: #fff; transition: background .12s, border-color .12s; }
.db-row:hover { background: #f5f8fc; }
.db-row.on { border-color: #b9d3ff; }
.db-row input, .db-sender input, .db-switch input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-width: 0; padding: 0; margin: 0; border: 0; }
.db-row-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row .db-tag { margin-left: 0; }
.db-check { width: 20px; height: 20px; flex: none; border-radius: 6px; border: 1.5px solid #c5d0de; display: grid; place-items: center; color: transparent; background: #fff; }
.db-check .ic { width: 13px; height: 13px; stroke-width: 3; }
.db-row.on .db-check, .db-sender.on .db-check { background: var(--blue); border-color: var(--blue); color: #fff; }
.db-row:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 1px; }
.db-send { margin-top: 12px; padding: 12px; font-size: 15.5px; }
.db-send:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Bài đã gửi ---------- */
.db-hist { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 12px 4px; font: inherit; color: inherit; cursor: pointer; }
.db-hist:last-child { border-bottom: 0; }
.db-hist:hover .db-hist-text { color: var(--blue); }
.db-hist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.db-hist-text { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-hist-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; }
.db-hist-stat { width: 190px; flex: none; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); text-align: right; }
.db-hist-stat b { color: var(--text); }
.db-prog { display: flex; height: 6px; border-radius: 99px; background: #eaf0f7; overflow: hidden; }
.db-prog span { height: 100%; }
.db-prog .ok { background: var(--green); }
.db-prog .err { background: var(--red); }
.db-prog .wait { background: #f5b83d; }

/* ---------- Hộp chi tiết ---------- */
.db-modal { max-width: 720px; width: 100%; max-height: 88vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.db-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.db-modal-head h3 { margin: 0; }
.db-modal-body { padding: 16px 20px 20px; overflow-y: auto; overflow-x: hidden; }
.db-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f0f3f8; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.db-x:hover { background: #e3e9f1; color: var(--text); }
.db-post { background: #f6f8fb; border-radius: 12px; padding: 12px 14px; }
.db-post-text { white-space: pre-wrap; max-height: 150px; overflow-y: auto; font-size: 14.5px; margin-bottom: 6px; }
.db-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 14px 0 8px; font-size: 14px; }
.db-summary .db-prog { flex-basis: 100%; height: 8px; }
.db-dlist { display: grid; gap: 2px; }
.db-drow { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #f0f3f7; }
.db-drow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.db-drow-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-drow-main small, .db-drow-st small { color: var(--muted); font-size: 12px; }
.db-drow-st { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.db-drow-st .db-tag { margin: 0; }
.db-resend { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- Nhóm chính ---------- */
.db-rule { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin-top: 12px; }
.db-rule.off { background: #fafbfd; }
.db-rule.off .db-flow { opacity: .55; }
.db-rule-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.db-rule-head > b { font-size: 16px; }
.db-flow { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; flex-wrap: wrap; }
.db-flow-node { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 12px; background: #f3f6fa; min-width: 0; }
.db-flow-node > span { display: flex; flex-direction: column; min-width: 0; }
.db-flow-node b { font-size: 14px; }
.db-flow-node small { font-size: 12px; color: var(--muted); }
.db-flow-node.src { background: var(--blue-soft); }
.db-flow-ic, .db-flow-n { font-style: normal; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--blue), #3fa2ff); flex: none; }
.db-flow-n { background: linear-gradient(135deg, #22c55e, #16a34a); font-size: 15px; }
.db-flow-arrow { width: 22px; height: 22px; color: var(--muted); }
.db-rule-meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; }
.db-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.db-switch { position: relative; }
.db-switch span { width: 38px; height: 22px; border-radius: 99px; background: #cfd8e3; position: relative; transition: background .15s; }
.db-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.db-switch input:checked + span { background: var(--green); }
.db-switch input:checked + span::after { transform: translateX(16px); }
.db-switch:has(input:checked) { color: var(--green); }

.db-step { display: flex; gap: 12px; margin: 16px 0; }
.db-step-n { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.db-step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.db-step-body > b { font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-step-body select { width: 100%; }
.db-step-body > .btn { align-self: flex-start; }
.db-senders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 280px; overflow-y: auto; }
.db-sender { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--border); cursor: pointer; background: #fff; }
.db-sender.on { border-color: var(--blue); background: var(--blue-soft); }
.db-sender { position: relative; }
.db-sender > span:nth-child(3) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.db-sender small { color: var(--muted); font-size: 12px; }
#ruleForm .db-targets { border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; max-height: 380px; overflow-y: auto; }

/* ---------- Nick gửi bài ---------- */
.db-accs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.db-acc-card { border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.db-acc-top { display: flex; align-items: center; gap: 10px; }
.db-acc-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.db-acc-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-acc-name small { color: var(--muted); font-size: 12.5px; }
.db-acc-top .db-tag { margin: 0; }
.db-acc-groups { font-size: 14px; color: var(--muted); }
.db-acc-groups b { color: var(--text); font-size: 18px; }
.db-acc-card .db-actions { margin-top: auto; }
.db-acc-new { border: 1.5px dashed #c5d3e6; background: #f9fbfe; justify-content: center; }
.db-acc-new input { width: 100%; }
.db-qr { display: flex; gap: 18px; align-items: center; margin-top: 16px; padding: 16px; border-radius: 16px; background: var(--blue-soft); }
.db-qr img { width: 180px; height: 180px; background: #fff; border-radius: 14px; padding: 8px; flex: none; }
.db-qr img:not([src]) { visibility: hidden; }

/* ---------- Hướng dẫn 3 bước khi chưa có nhóm ---------- */
.db-onboard h3 { margin: 0 0 12px; }
.db-onboard ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.db-onboard li { display: flex; gap: 10px; padding: 12px; border-radius: 14px; background: #f5f8fc; }
.db-onboard li > span { width: 28px; height: 28px; flex: none; border-radius: 50%; background: #dbe5f2; color: var(--text); font-weight: 800; display: grid; place-items: center; }
.db-onboard li.done > span { background: var(--green); color: #fff; }
.db-onboard li p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.db-onboard a { color: var(--blue); }

/* ---------- Màn hẹp ---------- */
@media (max-width: 960px) {
  .db-compose { grid-template-columns: 1fr; }
  .db-sticky { position: static; max-height: none; }
  .db-sticky .db-targets { max-height: 420px; }
}
@media (max-width: 640px) {
  .db-hero { flex-direction: column; align-items: flex-start; margin-top: 18px; }
  .db-hero h1 { font-size: 23px; }
  .db-stats { grid-template-columns: 1fr 1fr; }
  .db-stats .db-stat:first-child { grid-column: span 2; }
  .db-tabs { display: flex; }
  .db-tab { flex: 1; justify-content: center; padding: 8px 6px; font-size: 13.5px; gap: 5px; }
  .db-tab .ic { display: none; }
  .db-card { padding: 15px 14px; border-radius: 16px; }
  .db-hist { flex-direction: column; align-items: stretch; gap: 8px; }
  .db-hist-stat { width: auto; text-align: left; }
  .db-onboard ol { grid-template-columns: 1fr; }
  .db-qr { flex-direction: column; text-align: center; }
  .db-flow-arrow { transform: rotate(90deg); }
  .db-flow { flex-direction: column; align-items: flex-start; }
  .db-modal-body { padding: 14px; }
  .db-modal-head { padding: 14px; }
}

/* ---------- Ảnh + thống kê trong Bài đã gửi ---------- */
.db-hist-img { position: relative; width: 56px; height: 56px; flex: none; border-radius: 12px; overflow: hidden; background: #eef2f7; display: grid; place-items: center; color: var(--muted); }
.db-hist-img img { width: 100%; height: 100%; object-fit: cover; }
.db-hist-img.gone img { display: none; }
.db-hist-img.text .ic { width: 20px; height: 20px; }
.db-hist-img em { position: absolute; right: 3px; bottom: 3px; padding: 0 5px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; line-height: 17px; }
.db-post-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-bottom: 10px; }
.db-post-imgs a { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e6ecf4; }
.db-post-imgs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.db-stats7 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 8px; padding: 14px; border-radius: 14px; background: #f6f9fd; border: 1px solid var(--border); }
.db-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.db-kpis > div { background: #fff; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; border: 1px solid #e8eef6; }
.db-kpis b { font-size: 24px; line-height: 1.15; }
.db-kpis b.ok { color: var(--green); }
.db-kpis b.warn { color: var(--amber); }
.db-kpis span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.db-chart { display: flex; flex-direction: column; min-width: 0; }
.db-chart-bars { flex: 1; min-height: 120px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.db-chart-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.db-chart-stack { width: 100%; max-width: 34px; min-height: 3px; display: flex; flex-direction: column; border-radius: 7px 7px 3px 3px; overflow: hidden; background: #e3eaf3; }
.db-chart-stack i { display: block; min-height: 3px; }
.db-chart-stack .ok { background: linear-gradient(180deg, #3fa2ff, var(--blue)); }
.db-chart-stack .err { background: var(--red); }
.db-chart-col small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.db-chart-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) {
  .db-stats7 { grid-template-columns: 1fr; }
  .db-hist { flex-direction: row; flex-wrap: wrap; }
  .db-hist-main { flex-basis: calc(100% - 72px); }
  .db-hist-stat { flex-basis: 100%; }
}

/* ---------- Tốc độ gửi ---------- */
.db-speed { margin-top: 10px; }
.db-speed .db-sub { margin-top: 0; }
.db-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: #eef2f7; border-radius: 12px; }
.db-seg button { border: 0; background: transparent; border-radius: 9px; padding: 7px 4px; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--muted); }
.db-seg button b { font-size: 13.5px; }
.db-seg button small { font-size: 11px; }
.db-seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(23,33,47,.12); }
.db-seg button.on.fast { color: var(--red); }
.db-seg button.on.safe { color: var(--green); }
.db-seg button.on.slow { color: var(--blue); }
.db-risk > div { display: flex; flex-direction: column; gap: 6px; }
.db-risk-check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-weight: 600; cursor: pointer; }
.db-risk-check input { width: 16px; height: 16px; min-width: 0; margin-top: 2px; flex: none; accent-color: var(--red); }
.db-risk .db-actions { margin-top: 2px; }
.db-seg button.on.custom { color: #7c3aed; }
.db-custom { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.db-custom-row { display: flex; gap: 10px; flex-wrap: wrap; }
.db-custom-row label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }
.db-custom-row input { width: 92px; min-width: 0; padding: 6px 8px; }
.db-custom .db-risk { margin-top: 0; }
