/* Giao diện riêng của công cụ kiểm tra mật độ từ khóa. Mọi quy tắc bắt đầu bằng .tl-page */
.tl-page {
  --blue: #004aef; --blue-d: #0033b3; --green: #07ef9c; --cyan: #0fd6f7; --yellow: #ffce00;
  --bg: #f4f7fd; --surface: #ffffff; --ink: #212025; --text: #434343; --muted: #616a7a;
  --line: #dbe3f5; --blue-soft: #e3ebff; --green-soft: #dcfbef; --cyan-soft: #e3fafe; --yellow-soft: #fff6d6;
  --red: #dc2f2f; --red-soft: #f6cbcb; --red-ink: #8f1d1d;
}
.tl-page .fig { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.tl-page .fig h3 { color: var(--ink); font-size: 18px; line-height: 1.35; font-weight: 700; margin: 0 0 12px; }
.tl-page .fig svg { display: block; width: 100%; height: auto; }
.tl-page .fig-cap { font-size: 13.5px; color: var(--muted); margin-top: 14px; line-height: 1.5; margin-bottom: 0; }
.tl-page .fig-cap b { color: var(--ink); }
.tl-page .legend { margin-top: 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 26px; }
.tl-page .leg { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; }
.tl-page .leg .leg-t { display: block; font-size: 15px; line-height: 1.35; color: var(--ink); }
.tl-page .leg p { font-size: 14px; color: var(--muted); margin: 4px 0 0; }
.tl-page .pin { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: var(--ink); font-weight: 700; font-size: 12.5px; line-height: 24px; text-align: center; display: inline-block; flex: none; }

.tl-page .note { margin-top: 18px; background: var(--blue-soft); border-radius: 14px; padding: 14px 18px; font-size: 14.5px; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; color: var(--ink); }
.tl-page .note .ic { width: 20px; height: 20px; margin-top: 3px; fill: var(--blue); flex: none; }
.tl-page .note.warn { background: var(--yellow-soft); }
.tl-page .note.warn .ic { fill: #7a5f00; }
.tl-page .note.ok { background: var(--green-soft); color: #046b47; }
.tl-page .note.ok .ic { fill: #046b47; }
.tl-page .note.loi { background: var(--red-soft); color: var(--red-ink); }
.tl-page .note.loi .ic { fill: var(--red); }

.tl-page .bul { margin-top: 12px; padding-left: 0; list-style: none; }
.tl-page .bul li { position: relative; padding-left: 22px; margin-top: 8px; font-size: 15px; }
.tl-page .bul li:before { content: ""; position: absolute; left: 4px; top: 10px; width: 7px; height: 7px; border-radius: 2px; background: var(--blue); }


.tl-page .tool-btns { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.tl-page .btn { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 9px 15px; font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1.2; cursor: pointer; }
.tl-page .btn:hover { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-d); }
.tl-page .btn-chinh { background: var(--blue); border-color: var(--blue); color: #fff; }
.tl-page .btn-chinh:hover { background: var(--blue-d); border-color: var(--blue-d); color: #fff; }

.tl-page .so-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tl-page .so { background: var(--bg); border-radius: 14px; padding: 12px 10px; text-align: center; min-width: 0; }
.tl-page .so .v { font-weight: 700; font-size: 23px; line-height: 1.15; color: var(--blue); font-variant-numeric: tabular-nums; word-break: break-word; }
.tl-page .so .t { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.tl-page .so.phu .v { font-size: 18px; color: var(--ink); }

.tl-page .tk-list { margin-top: 16px; display: grid; gap: 10px; }
.tl-page .tk-item { background: var(--bg); border-radius: 14px; padding: 13px 15px; border-left: 4px solid var(--line); }
.tl-page .tk-item.ok { border-left-color: var(--blue); }
.tl-page .tk-item.thap { border-left-color: var(--yellow); }
.tl-page .tk-item.cao { border-left-color: var(--red); }
.tl-page .tk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.tl-page .tk-ten { font-weight: 700; font-size: 15px; color: var(--ink); word-break: break-word; }
.tl-page .tk-loai { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; margin-right: 6px; background: var(--blue-soft); color: var(--blue-d); vertical-align: middle; }
.tl-page .tk-loai.phu { background: var(--cyan-soft); color: #0a6a7d; }
.tl-page .tk-badge { font-weight: 700; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.tl-page .tk-badge.ok { background: var(--green-soft); color: #046b47; }
.tl-page .tk-badge.thap { background: var(--yellow-soft); color: #7a5f00; }
.tl-page .tk-badge.cao { background: var(--red-soft); color: var(--red-ink); }
.tl-page .tk-badge.trong { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.tl-page .tk-so { margin-top: 6px; font-size: 13px; color: var(--muted); }
.tl-page .tk-so b { color: var(--ink); }

.tl-page .vi-tri-bar { position: relative; height: 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); margin-top: 10px; overflow: hidden; }
.tl-page .vi-tri-bar .chia { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-page .vi-tri-bar .cham { position: absolute; top: 1px; bottom: 1px; width: 6px; border-radius: 3px; background: var(--blue); transform: translateX(-50%); }
.tl-page .vi-tri-bar .cham.phu { background: #0a6a7d; }
.tl-page .vi-tri-chu { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.tl-page .vung-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tl-page .vung-o { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-align: center; }
.tl-page .vung-o.co { background: var(--green-soft); border-color: #046b47; }
.tl-page .vung-o.nhieu { background: var(--red-soft); border-color: var(--red); }
.tl-page .vung-ten { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.tl-page .vung-so { font-size: 20px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.tl-page .vung-phu { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tl-page .vung-o.co .vung-so, .tl-page .vung-o.co .vung-phu { color: #046b47; }
.tl-page .vung-o.nhieu .vung-so, .tl-page .vung-o.nhieu .vung-phu { color: var(--red-ink); }

.tl-page .soi-khung { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; max-height: 290px; overflow-y: auto; font-size: 15px; line-height: 1.7; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.tl-page .soi-trong { color: var(--muted); margin: 0; }
.tl-page .hl-chinh { background: var(--yellow-soft); color: #7a5f00; font-weight: 700; padding: 1px 5px; border-radius: 6px; border: 1px solid var(--yellow); }
.tl-page .hl-phu { background: var(--green-soft); color: #046b47; font-weight: 600; padding: 1px 5px; border-radius: 6px; }

.tl-page .bang-doi { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.tl-page .tu-bang { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tl-page .tu-bang th { background: var(--blue-soft); color: var(--ink); text-align: left; padding: 10px 12px; font-weight: 700; }
.tl-page .tu-bang th:last-child { text-align: right; }
.tl-page .tu-bang td { padding: 9px 12px; border-top: 1px solid var(--line); }
.tl-page .tu-bang td:first-child { font-weight: 600; color: var(--ink); word-break: break-word; }
.tl-page .tu-bang td:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.tl-page .tu-bang .td-trong { text-align: left; color: var(--muted); font-weight: 400; white-space: normal; }
.tl-page .canh-nhoi { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--red-soft); color: var(--red-ink); }

@media (max-width: 960px) {
    .tl-page .bang-doi { grid-template-columns: minmax(0,1fr); }
  .tl-page .bang-doi > * { min-width: 0; overflow-x: auto; }
  .tl-page .vung-grid { grid-template-columns: repeat(2, 1fr); }
  .tl-page .legend { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .tl-page .so-grid { grid-template-columns: repeat(2, 1fr); }
  .tl-page .vung-grid { grid-template-columns: 1fr; }
  .tl-page .tl-hop > .block { padding: 18px; border-radius: 16px; }
}

/* ===== Bố cục hai cột theo trang mẫu kiem-tra-ma-phan-hoi (07/11/2026) ===== */
.tl-page .tl-hop > .block { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin-top: 24px; }
.tl-page .tl-hop > .block .fig { margin-top: 14px; padding: 0; border: 0; border-radius: 0; background: none; }
.tl-page .tl-hop > .block .tbl-wrap { margin-top: 0; border-radius: 14px; }
.tl-page .md-buoc { margin: 0 0 18px; }
.tl-page .tl-cc-trai input[type="text"] { padding: 11px 14px; font-family: inherit; font-size: 15px; color: var(--ink); }
.tl-page #nhap { display: block; height: 300px; min-height: 240px; resize: vertical; padding: 12px 14px; font-family: inherit; font-size: 15px; line-height: 1.6; color: var(--ink); }
.tl-page .tl-cc-thu { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.tl-page .tl-cc-lien.md-phu { color: var(--muted); font-weight: 500; }
.tl-page #md-kq[hidden] { display: none; }
.tl-page #hop-nhan-xet { margin-top: 14px; }
.tl-page .tl-cc-vd .note { margin-top: 12px; }
.tl-page .tl-cc-ma { white-space: nowrap; }
.tl-page .tu-bang td.td-trong { text-align: left; }
@media (max-width: 520px) { .tl-page .tu-bang td:last-child, .tl-page .tu-bang th { white-space: normal; } }
