/* GIAO DIỆN CHUNG. Màu chủ đạo đặt ở :root, đổi 1 chỗ là đổi cả web.
   Thiết kế ưu tiên điện thoại: mọi bảng nằm trong .cuon (vuốt ngang được). */
:root {
  --nen: #f4f6f9; --the: #fff; --chu: #1f2933; --mo: #6b7785; --vien: #e1e5ea;
  --chinh: #2563eb; --chinh-dam: #1d4ed8; --xanh: #15803d; --do: #b91c1c; --vang: #a16207;
  --nen-xanh: #e8f6ec; --nen-do: #fdecec; --nen-vang: #fff6dc; --nen-xam: #eef1f4;
  --bo-goc: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--nen); color: var(--chu); font-size: 15px; line-height: 1.5; }
a { color: var(--chinh); }
h1 { font-size: 1.4rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: .8rem 0 .5rem; }
code { background: var(--nen-xam); padding: 1px 5px; border-radius: 4px; font-size: .85em; word-break: break-all; }
.mo { color: var(--mo); }
small { font-size: .82em; }

/* Thanh menu trên cùng */
.thanh-tren { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  background: #111827; color: #fff; padding: .6rem 1rem; position: sticky; top: 0; z-index: 10; }
.logo { color: #fff; font-weight: 700; text-decoration: none; }
.menu { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.menu a, .menu .nut-chu { color: #d1d5db; text-decoration: none; padding: .35rem .7rem; border-radius: 8px; background: none; border: 0; font: inherit; cursor: pointer; }
.menu a.dang-chon, .menu a:hover, .menu .nut-chu:hover { background: #374151; color: #fff; }

.noi-dung { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.chan-trang { max-width: 1100px; margin: 0 auto; padding: 1rem; color: var(--mo); font-size: .85rem; }

/* Khối, thẻ */
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo-goc); padding: 1rem; margin-bottom: 1rem; }
.the.hep { max-width: 480px; margin: 1rem auto; }
.dau-the { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dau-trang { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.phan-them { border-top: 1px dashed var(--vien); margin-top: 1rem; padding-top: .5rem; }

/* Thông báo */
.thong-bao { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.thong-bao.thanh_cong { background: var(--nen-xanh); color: var(--xanh); border-color: #b7e2c3; }
.thong-bao.loi { background: var(--nen-do); color: var(--do); border-color: #f4c2c2; }
.thong-bao.canh_bao { background: var(--nen-vang); color: #6b4e00; border-color: #f1dd9c; }
.thong-bao .nut { margin-left: .5rem; }
.bang-canh-bao { background: #fde68a; color: #4a3500; padding: .55rem 1rem; text-align: center; }
.bang-du-lieu-mau { background: repeating-linear-gradient(45deg, #fff3c4, #fff3c4 12px, #ffe9a3 12px, #ffe9a3 24px);
  border: 2px dashed #d4a017; color: #5c4300; padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 1.02rem; }

/* Nút */
.nut { display: inline-block; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--vien); background: #fff; color: var(--chu);
  font: inherit; cursor: pointer; text-decoration: none; }
.nut:hover { background: var(--nen-xam); }
.nut.chinh { background: var(--chinh); border-color: var(--chinh); color: #fff; }
.nut.chinh:hover { background: var(--chinh-dam); }
.nut.nguy-hiem { color: var(--do); border-color: #f0b4b4; }
.nut.nho { padding: .25rem .6rem; font-size: .88rem; }
.nut[disabled] { opacity: .45; cursor: not-allowed; }
.rong-het { width: 100%; }
.hang-nut { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
td.hang-nut { margin: 0; }
.form-dong { display: inline; margin: 0; }

/* Form */
.form label { display: block; margin-bottom: .8rem; font-weight: 500; }
.form input:not([type=checkbox]), .form select { display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem;
  border: 1px solid #c9d0d8; border-radius: 8px; font: inherit; background: #fff; }
.form input:focus, .form select:focus { outline: 2px solid #bfd3fb; border-color: var(--chinh); }
.form input[disabled] { background: var(--nen-xam); }
.form-ngang { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; align-items: end; }
.form fieldset { border: 1px solid var(--vien); border-radius: 8px; margin: 0 0 .8rem; padding: .5rem .8rem; }
.dong-tick { display: flex !important; gap: .5rem; align-items: baseline; font-weight: 400 !important; margin-bottom: .45rem !important; flex-wrap: wrap; }
.da-luu { display: block; font-weight: 400; color: var(--mo); font-size: .88rem; }

/* Đăng nhập */
.hop-dang-nhap { max-width: 360px; margin: 10vh auto 0; background: #fff; padding: 1.6rem; border-radius: 14px; border: 1px solid var(--vien); }
.hop-dang-nhap h1 { text-align: center; }
.hop-dang-nhap .mo { text-align: center; margin-top: -.4rem; }

/* Menu con trong Cài đặt, chọn kỳ ở Tổng quan */
.menu-con, .chon-ky { display: flex; gap: .3rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: 2px; }
.menu-con a, .chon-ky a { white-space: nowrap; padding: .4rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--vien);
  text-decoration: none; color: var(--chu); font-size: .92rem; }
.menu-con a.dang-chon, .chon-ky a.dang-chon { background: var(--chinh); border-color: var(--chinh); color: #fff; }
.chon-ky { margin-bottom: 0; }

/* Huy hiệu trạng thái kết nối */
.huy-hieu { font-size: .82rem; padding: .2rem .65rem; border-radius: 999px; font-weight: 600; }
.huy-hieu.chua_cai, .huy-hieu.chua_kiem_tra { background: var(--nen-xam); color: var(--mo); }
.huy-hieu.da_ket_noi { background: var(--nen-xanh); color: var(--xanh); }
.huy-hieu.loi { background: var(--nen-do); color: var(--do); }
.ket-qua { border-left: 4px solid var(--vien); padding: .5rem .8rem; margin: .6rem 0; background: var(--nen-xam); border-radius: 0 8px 8px 0; }
.ket-qua.da_ket_noi { border-color: var(--xanh); background: var(--nen-xanh); }
.ket-qua.loi { border-color: var(--do); background: var(--nen-do); }
.ket-qua > div { margin-top: .2rem; }
.huong-dan { margin-top: .8rem; background: #f8fafc; border: 1px solid var(--vien); border-radius: 8px; padding: .5rem .8rem; }
.huong-dan summary { cursor: pointer; font-weight: 600; }
.huong-dan li { margin-bottom: .3rem; }

/* Ô số ở Tổng quan */
.luoi-o-so { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.o-so { background: #fff; border: 1px solid var(--vien); border-radius: var(--bo-goc); padding: .8rem; }
.o-so span { display: block; color: var(--mo); font-size: .85rem; }
.o-so b { font-size: 1.3rem; }
.so-am { color: var(--do); }
.so-duong { color: var(--xanh); }
.nhan { font-size: .75rem; padding: .12rem .5rem; border-radius: 999px; font-weight: 600; vertical-align: middle; white-space: nowrap; }
.nhan.tam-tinh { background: var(--nen-vang); color: var(--vang); border: 1px solid #f1dd9c; }
.nhan.da-chot { background: var(--nen-xanh); color: var(--xanh); border: 1px solid #b7e2c3; }

/* Biểu đồ SVG */
.bieu-do { width: 100%; height: auto; display: block; }
.bieu-do .luoi { stroke: #eceff3; }
.bieu-do .truc-0 { stroke: #9aa5b1; }
.bieu-do .chu-truc { font-size: 11px; fill: var(--mo); }
.bieu-do .cot-chi-phi { fill: #93b4f5; }
.bieu-do .duong-lai { fill: none; stroke: var(--xanh); stroke-width: 2.5; }
.bieu-do .cham-lai { fill: var(--xanh); stroke: #fff; stroke-width: 1.5; }
.bieu-do .cham-lai.am { fill: var(--do); }
.chu-thich { font-size: .85rem; color: var(--mo); margin-bottom: .3rem; }
.cham { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 .3rem 0 .6rem; vertical-align: middle; }
.cham.chi-phi { background: #93b4f5; }
.cham.lai { background: var(--xanh); border-radius: 50%; }

/* Bảng */
.cuon { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .5rem .55rem; border-bottom: 1px solid var(--vien); text-align: left; vertical-align: top; }
th { background: #f8fafc; font-weight: 600; white-space: nowrap; }
td.so, th.so { text-align: right; white-space: nowrap; }
tr.mo td { color: var(--mo); }

@media (max-width: 600px) {
  .noi-dung { padding: .7rem; }
  .o-so b { font-size: 1.1rem; }
  .luoi-o-so { grid-template-columns: repeat(2, 1fr); }
}
