/* Brisky — giao diện: thanh menu bên trái (máy tính) / ngăn kéo (điện thoại), thẻ bo tròn, màu xanh dịu */
:root {
  --brand: #1f33c2; --brand-dark: #0b1470; --brand-soft: #e6e9fb; --accent: #ffe600;
  --ink: #172036; --muted: #6b7690; --line: #e4e9f2; --bg: #f3f6fb; --card: #fff;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2;
  --side: #0a1160; --side-ink: #c4cde0; --side-w: 232px;
  --shadow: 0 1px 2px rgba(10, 17, 96, .05), 0 4px 14px rgba(10, 17, 96, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ---------- Khung trang ---------- */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.top { display: none; position: sticky; top: 0; z-index: 20; align-items: center; gap: 12px; padding: 10px 14px; background: var(--side); color: #fff; }
.top .burger { font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; cursor: pointer; user-select: none; }
.top .burger:active { background: rgba(255, 255, 255, .12); }
.top .brand { display: block; background: #fff; border-radius: 10px; padding: 3px 10px; }
.top .brand img { display: block; height: 28px; width: auto; }
.top .who-m { margin-left: auto; font-size: 13px; color: var(--side-ink); }

.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.side .logo { display: block; margin: 14px 14px 6px; padding: 10px 12px; background: #fff; border-radius: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.side .logo img { display: block; width: 100%; height: auto; }
.side .grp { margin: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #7f8cab; }
.side nav a { display: flex; align-items: center; gap: 11px; margin: 1px 10px; padding: 9px 12px; border-radius: 10px; color: var(--side-ink); font-weight: 500; }
.side nav a .ic { width: 22px; text-align: center; font-size: 17px; filter: saturate(.85); }
.side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side nav a.on { background: var(--brand); color: #fff; font-weight: 600; position: relative; box-shadow: 0 4px 12px rgba(31, 51, 194, .4); }
.side nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.side .me { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 14px; }
.side .me a { color: #fff; font-weight: 600; display: block; }
.side .me small { display: block; color: #7f8cab; margin-bottom: 8px; }
.side .me button.link { color: var(--side-ink); text-decoration: none; font-size: 13px; }
.side .me button.link:hover { color: #fff; }
.scrim { display: none; }

main { margin-left: var(--side-w); max-width: 1240px; padding: 26px 30px 60px; }
@media (min-width: 901px) { body { overflow-x: hidden; } }
h1 { font-size: 24px; margin: 0 0 18px; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: linear-gradient(var(--brand), var(--accent)); }
.muted { color: var(--muted); }

/* ---------- Thẻ, số liệu, bảng ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 14px 20px; box-shadow: var(--shadow); color: var(--muted); font-size: 13px; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--brand); }
.stat:nth-child(6n+2)::before { background: #8b5cf6; } .stat:nth-child(6n+3)::before { background: #f59e0b; }
.stat:nth-child(6n+4)::before { background: #06b6d4; } .stat:nth-child(6n+5)::before { background: #ef4444; } .stat:nth-child(6n+6)::before { background: #10b981; }
.stat b { display: block; font-size: 26px; line-height: 1.2; color: var(--ink); letter-spacing: -.3px; }
.stat a { font-weight: 600; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; white-space: nowrap; background: #f8faff; }
tbody tr:hover td, table tr:hover td { background: #fafcff; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td a { font-weight: 500; }

/* ---------- Biểu mẫu ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; color: var(--ink); border: 1px solid #cfd8e6; border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 51, 194, .16); }
textarea { min-height: 76px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.bar label { margin: 0; flex: 1 1 160px; }
.btn { display: inline-block; padding: 10px 18px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .05s, box-shadow .15s; box-shadow: 0 2px 6px rgba(31, 51, 194, .25); }
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #cfd8e6; box-shadow: none; }
.btn.ghost:hover { background: #f3f6fb; color: var(--ink); }
.btn.ok { background: var(--ok); box-shadow: 0 2px 6px rgba(21, 128, 61, .25); } .btn.ok:hover { background: #106b32; }
.btn.bad { background: var(--bad); box-shadow: none; } .btn.bad:hover { background: #991b1b; }
.btn.big { width: 100%; padding: 16px; font-size: 17px; border-radius: 12px; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
form.inline { display: inline; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #e8edf5; color: #44506a; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.info { background: #dbeafe; color: #1d4ed8; }
.flash { background: var(--ok-soft); color: var(--ok); padding: 11px 14px; border-radius: 10px; font-weight: 500; margin: 0 0 16px; }
.flash.err { background: var(--bad-soft); color: var(--bad); }

/* ---------- Điểm danh: nút chọn lớn, dễ bấm trên điện thoại ---------- */
.marks { display: flex; gap: 8px; }
.marks input { position: absolute; opacity: 0; width: 0; }
.marks span { display: block; min-width: 84px; text-align: center; padding: 9px 14px; border: 1px solid #cfd8e6; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); background: #fff; white-space: nowrap; transition: all .12s; }
.marks label { margin: 0; }
.marks input:checked + span.p { background: var(--ok); color: #fff; border-color: var(--ok); box-shadow: 0 3px 8px rgba(21, 128, 61, .3); }
.marks input:checked + span.a { background: var(--bad); color: #fff; border-color: var(--bad); box-shadow: 0 3px 8px rgba(185, 28, 28, .3); }
.marks input:checked + span.e { background: var(--warn); color: #fff; border-color: var(--warn); }
.marks input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Đăng nhập ---------- */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(circle at 15% 12%, #d4daf8, transparent 45%), radial-gradient(circle at 88% 88%, #fff6a8, transparent 42%), var(--bg); }
body.login .card { width: 100%; max-width: 380px; padding: 28px 26px; border-radius: 18px; box-shadow: 0 12px 40px rgba(10, 17, 96, .12); }
body.login .login-logo { display: block; width: 78%; max-width: 270px; height: auto; margin: 0 auto 4px; }
body.login .btn { width: 100%; padding: 12px; }

/* ---------- Bảng công việc ---------- */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
.board section { background: #e9eef7; border-radius: 14px; padding: 12px; }
.board h2 { margin: 0 0 10px; font-size: 14px; } .board h2::before { display: none; }
.task { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; color: var(--ink); box-shadow: var(--shadow); }
.task b, .task span { display: block; }
.task .tag { display: inline-block; margin-top: 4px; }

/* ---------- Đánh giá hài lòng ---------- */
table.survey tr.grp td { background: #eef2f9; }
table.survey tr.lv-red td:nth-child(3) { background: #fee2e2; }
table.survey tr.lv-orange td:nth-child(3) { background: #ffedd5; }
table.survey tr.lv-blue td:nth-child(3) { background: #dbeafe; }

/* ---------- Bảng tổng quan trung tâm ---------- */
.chart { display: flex; gap: 10px; align-items: flex-end; height: 190px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 10px; margin-bottom: 16px; box-shadow: var(--shadow); }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: 12px; color: var(--muted); min-width: 0; }
.chart .col i { display: block; width: 100%; max-width: 54px; background: linear-gradient(180deg, #5a6cf0, #1f33c2); border-radius: 8px 8px 0 0; min-height: 3px; margin: 4px 0; }
.chart .col:last-child i { background: linear-gradient(180deg, #34d399, #10b981); }
.chart .col .val { font-weight: 700; color: var(--ink); }
.attn { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.attn .card { margin: 0; padding: 14px 16px; }
.attn .card > div { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.attn .card > div:last-child { border: 0; }
.attn .card > b { display: block; margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* ---------- Điện thoại / máy tính bảng ---------- */
@media (max-width: 900px) {
  .top { display: flex; }
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; width: 270px; }
  .nav-toggle:checked ~ .side { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, .35); }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 25; }
  main { margin-left: 0; padding: 16px 14px 60px; }
  h1 { font-size: 21px; margin-bottom: 14px; }
  .board { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  th, td { padding: 9px 10px; }
  /* Điểm danh trên điện thoại: mỗi học viên một thẻ — tên + buổi còn, hàng nút lớn, ô ghi chú */
  table.att tr:first-child { display: none; }
  table.att tr { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
  table.att tr:last-child { border: 0; }
  table.att td { padding: 0; border: 0; background: none !important; }
  table.att td.m, table.att td.t { grid-column: 1 / -1; }
  table.att .marks label { flex: 1; }
  table.att .marks span { width: 100%; padding: 11px 0; font-size: 15px; }
  .marks span { min-width: 0; padding: 9px 12px; }
  .stat b { font-size: 22px; }
  .chart { height: 160px; gap: 6px; }
}

/* Lọc nhanh */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.chip { display: inline-block; padding: 5px 12px; border-radius: 99px; background: #fff; border: 1px solid #cfd8e6; color: var(--ink); font-size: 13px; font-weight: 500; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Lịch điểm danh (trang học viên) ---------- */
.cal-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.cal-nav b { min-width: 110px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day { min-height: 74px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px; min-width: 0; overflow: hidden; }
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-num { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.cal-chip { display: block; font-size: 10px; line-height: 1.3; margin-top: 2px; padding: 1px 4px; border-radius: 4px; white-space: normal; overflow-wrap: anywhere; }
.cal-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
@media (max-width: 600px) {
  .cal { gap: 2px; }
  .cal-day { min-height: 56px; padding: 2px; }
  .cal-chip { font-size: 9px; padding: 1px 2px; }
}

/* ---------- Tổng số buổi có mặt / được bồi / vắng (lịch sử điểm danh) ---------- */
.ls-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 10px; }
.ls-card { border-radius: 12px; padding: 10px 6px; text-align: center; display: grid; gap: 2px; }
.ls-card b { font-size: 22px; line-height: 1.1; }
.ls-card span { font-size: 12px; font-weight: 600; }
.ls-card.ok { background: var(--ok-soft); color: var(--ok); }
.ls-card.info { background: #dbeafe; color: #1d4ed8; }
.ls-card.bad { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 600px) { .ls-card b { font-size: 18px; } .ls-card span { font-size: 11px; } }

/* Popup xác nhận bảo lưu */
dialog.bl-dlg { border: 0; border-radius: 14px; padding: 20px; width: min(520px, 92vw); box-shadow: 0 20px 50px rgba(10, 20, 60, .25); color: #172036; }
dialog.bl-dlg::backdrop { background: rgba(10, 20, 60, .45); }
dialog.bl-dlg h3 { margin: 0 0 6px; }
dialog.bl-dlg .dlg-act { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
