/* Kitto Math — bộ giao diện chung (kiểu Mori CRM / Lark: nền xám lạnh, thẻ trắng, viền mảnh, nhiều màu theo nghĩa).
   Màu thương hiệu Kitto: xanh lá #136c40 + lime #a6d66a (theo phiếu nhận xét KITTO và logo); theo docs/thiet-ke-fb.md (Facebook Kitto):
   mục menu đang chọn là pill xanh đặc chữ trắng, nhấn ấm cam / vàng cho hành động gửi phụ huynh, số liệu lớn màu xanh đậm.
   Tiền tố k-. Cách dùng + mẫu HTML: /mau-giao-dien/ và docs/kien-truc.md mục "Giao diện".
   LUẬT: không viết mã màu cứng trong template / CSS của app — dùng biến dưới đây và 8 tông k-t-*. */

/* ============================== 1. TOKEN ============================== */
:root {
  --brand: #136c40; --brand-dark: #0b5331; --brand-soft: #e9f4e3; --brand-ring: #a6d66a; --lime: #a6d66a; --lime-soft: #f1f8e8;
  --bg: #f5f6f8; --surface: #fff; --bg-soft: #f9fafb; --bg-soft-2: #f2f4f7;
  --line: #eaecf0; --line-2: #d0d5dd;
  --text: #1d2939; --text-2: #475467; --muted: #667085; --faint: #98a2b3;
  --red: #d92d20; --red-soft: #fef3f2; --orange: #b54708; --orange-soft: #fef0c7; --blue: #175cd3; --blue-soft: #eff4ff;
  --green: #136c40; --green-soft: #e9f4e3; --fb-green: #0a9347; --cam: #c2410c; --vang: #fcca0d;
  --r: 10px; --r-sm: 6px; --bo: 8px; --h: 38px; --h-sm: 32px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05); --shadow-pop: 0 12px 32px rgba(16, 24, 40, .14);
  --sb-w: 244px; --top-h: 56px; --duoi-h: 60px;
  /* 8 tông chip: nền nhạt + chữ đậm (tương phản >= 4.5:1) */
  --t-xam-nen: #f2f4f7;   --t-xam-chu: #344054;
  --t-la-nen: #e4f3dc;    --t-la-chu: #0f5a35;
  --t-duong-nen: #e8f0fe; --t-duong-chu: #1849a9;
  --t-tim-nen: #f1ebfd;   --t-tim-chu: #5b2fb8;
  --t-cam-nen: #ffeedd;   --t-cam-chu: #9a3412;
  --t-do-nen: #fdeceb;    --t-do-chu: #b42318;
  --t-vang-nen: #fdf3c8;  --t-vang-chu: #7a5300;
  --t-ngoc-nen: #dcf5f1;  --t-ngoc-chu: #0b6b5c;
}

/* ============================== 2. NỀN ============================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; }
button, input, select, textarea { font: inherit; color: inherit; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.k-mo { color: var(--muted); }
.k-nho { font-size: 13px; }
.k-so, td.k-so, th.k-so { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-giua { text-align: center; }
.k-dam { font-weight: 600; }
.k-cat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-an-dt { } /* ẩn trên điện thoại: xem media cuối file */
.k-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ============================== 3. KHUNG: thanh bên + thanh trên ============================== */
.k-sb { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 40; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transform: translateX(-102%); transition: transform .2s ease; }
.k-sb.mo-ra { transform: none; box-shadow: var(--shadow-pop); }
.k-sb-dau { display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; color: var(--brand); }
.k-sb-dau img { width: 34px; height: 34px; border-radius: 50%; }
.k-sb-dau b { font-size: 16px; letter-spacing: .01em; }
.k-sb-dau b span { color: var(--lime); -webkit-text-stroke: .3px var(--brand-dark); }
.k-sb-cuon { flex: 1; overflow-y: auto; padding: 8px 10px 20px; scrollbar-width: thin; }
.k-sb-nhom { margin: 14px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.k-sb-nhom:first-child { margin-top: 6px; }
.k-sb-i { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: var(--bo); color: var(--text-2); font-weight: 500; }
.k-sb-i .ic { color: var(--muted); }
.k-sb-i:hover { background: var(--bg-soft-2); color: var(--text); text-decoration: none; }
.k-sb-i.on { background: var(--brand); color: #fff; font-weight: 600; }
.k-sb-i.on .ic { color: var(--lime); }
.k-sb-i.on .k-sb-dem { background: #fff; color: var(--red); }
.k-sb-i span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-sb-dem { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700;
  display: inline-grid; place-items: center; }
.k-sb-cuoi { border-top: 1px solid var(--line); padding: 10px; flex: none; }
.k-che { position: fixed; inset: 0; z-index: 30; background: rgba(16, 24, 40, .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.k-che.mo-ra { opacity: 1; pointer-events: auto; }

.k-top { position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.k-top-logo { display: flex; align-items: center; gap: 8px; color: var(--brand); font-weight: 800; }
.k-top-logo img { width: 30px; height: 30px; border-radius: 50%; }
.k-tim { position: relative; flex: 1; max-width: 420px; }
.k-tim > .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.k-tim input { width: 100%; height: 36px; padding: 0 12px 0 36px; border: 1px solid transparent; border-radius: 18px; background: var(--bg-soft-2); font-size: 14px; }
.k-tim input:focus { background: #fff; border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px var(--brand-soft); }
.k-tim-kq { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: 6px; max-height: 70vh; overflow-y: auto; z-index: 50; }
.k-tim-kq a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--bo); color: var(--text); }
.k-tim-kq a:hover, .k-tim-kq a.on { background: var(--bg-soft-2); text-decoration: none; }
.k-tim-kq small { display: block; color: var(--muted); font-size: 12.5px; }
.k-tim-kq .k-rong { padding: 14px; }
.k-top-phai { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.k-chon-cs { height: 34px; max-width: 190px; padding: 0 28px 0 10px; border: 1px solid var(--line-2); border-radius: var(--bo); background: #fff; font-size: 13.5px; }
.k-chuong { position: relative; }
.k-chuong .k-sb-dem { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: 11px; border: 2px solid #fff; }
.k-menu-nd { position: relative; }
.k-menu-nd > summary { list-style: none; cursor: pointer; }
.k-menu-nd > summary::-webkit-details-marker { display: none; }
.k-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 50; }
.k-pop a, .k-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--bo);
  color: var(--text); text-align: left; cursor: pointer; font-size: 14px; }
.k-pop a:hover, .k-pop button:hover { background: var(--bg-soft-2); text-decoration: none; }
.k-pop .ic { color: var(--muted); }
.k-pop-dau { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.k-pop-dau small { display: block; color: var(--muted); }
.k-pop form { margin: 0; }
.k-pop-tb { width: min(360px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; }
.k-pop-tb a { align-items: flex-start; }
.k-pop-tb a.chua-doc b { color: var(--brand); }
.k-pop-tb a.chua-doc .ic { color: var(--brand); }
.k-pop-tb .k-dong-giua b { font-weight: 600; white-space: normal; }
.k-pop-tb .k-pop-cuoi { justify-content: center; color: var(--brand); border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; }
@media (max-width: 640px) { .k-chuong-hop .k-pop-tb { position: fixed; left: 12px; right: 12px; top: 58px; width: auto; } }

.k-main { padding: 16px 14px calc(var(--duoi-h) + 28px + env(safe-area-inset-bottom)); max-width: 1320px; margin: 0 auto; }
.k-main.hep { max-width: 860px; }

.k-duoi { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.k-duoi a, .k-duoi button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); font-size: 11px;
  border: 0; background: none; cursor: pointer; }
.k-duoi a.on { color: var(--brand); font-weight: 600; }
.k-duoi .ic { width: 22px; height: 22px; }
.k-duoi a:hover { text-decoration: none; }

@media (min-width: 1024px) {
  .k-sb { transform: none; z-index: 25; }
  .k-che, [data-mo-menu], .k-duoi, .k-top-logo { display: none !important; }
  .k-top { padding-left: calc(var(--sb-w) + 20px); padding-right: 20px; }
  .k-main { margin-left: var(--sb-w); padding: 22px 28px 48px; max-width: none; }
  .k-main > .k-noi { max-width: 1320px; }
  .k-main.hep > .k-noi { max-width: 860px; }
}

/* ============================== 4. ĐẦU TRANG ============================== */
.k-dau { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.k-dau-chu { flex: 1; min-width: 200px; }
.k-dau-chu p { margin: 4px 0 0; color: var(--muted); }
.k-dau-nut { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.k-lui { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.k-lui .ic { width: 15px; height: 15px; }

/* ============================== 5. NÚT ============================== */
.k-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h); padding: 0 14px; border-radius: var(--bo);
  border: 1px solid transparent; background: var(--bg-soft-2); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background .12s, border-color .12s; }
.k-btn:hover { text-decoration: none; background: #e7eaef; }
.k-btn:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 1px; }
.k-btn[disabled], .k-btn.tat { opacity: .45; cursor: not-allowed; }
.k-btn .ic { width: 17px; height: 17px; }
.k-chinh { background: var(--brand); color: #fff; }
.k-chinh:hover { background: var(--brand-dark); }
.k-phu { background: transparent; color: var(--text-2); }
.k-phu:hover { background: var(--bg-soft-2); }
.k-vien { background: #fff; border-color: var(--line-2); color: var(--text); }
.k-vien:hover { background: var(--bg-soft); }
.k-nhat { background: var(--brand-soft); color: var(--brand-dark); }
.k-nhat:hover { background: #d9edcd; }
.k-cam { background: var(--cam); color: #fff; }   /* hành động gửi phụ huynh / nổi bật ấm (theo FB Kitto) */
.k-cam:hover { background: #9a3412; }
.k-nguy { background: var(--red); color: #fff; }
.k-nguy:hover { background: #b42318; }
.k-nguy-vien { background: #fff; color: var(--red); border-color: #fecdca; }
.k-nguy-vien:hover { background: var(--red-soft); }
.k-them { background: transparent; color: var(--blue); padding: 0 8px; }
.k-them:hover { background: var(--blue-soft); }
.k-them .ic { background: var(--blue); color: #fff; border-radius: 50%; padding: 2px; width: 17px; height: 17px; }
.k-btn.k-nho { height: var(--h-sm); padding: 0 10px; font-size: 13px; }
.k-btn.k-day, .k-btn.k-rong { width: 100%; }  /* nút rộng hết cột: dùng k-day (k-rong trên nút giữ cho bản cũ) */
.k-btn.k-icon { width: var(--h); padding: 0; }
.k-btn.k-icon.k-nho { width: var(--h-sm); }
.k-btn.cho-xac-nhan { background: var(--red); color: #fff; border-color: var(--red); }
.k-nut-hang { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.k-nut-hang.phai { justify-content: flex-end; }
.k-nut-hang form { margin: 0; }

/* ============================== 6. THẺ, THẺ SỐ ============================== */
.k-the { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.k-the.sat { padding: 0; overflow: hidden; }
.k-the-dau { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.k-the.sat > .k-the-dau { padding: 14px 18px 0; }
.k-the-dau h2 { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: min(12em, 100%); }  /* không để chữ bên cạnh ép tiêu đề còn 1 cột (nx phiếu «Duyệt và gửi» 03/12) — thiếu chỗ thì phần bên cạnh xuống dòng */
.k-the-dau h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--lime); flex: none; }
.k-the-dau h2 .ic { color: var(--brand); }
.k-dem { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--bg-soft-2);
  color: var(--text-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.k-luoi { display: grid; gap: 16px; }
.k-luoi > * { min-width: 0; }
@media (min-width: 900px) {
  .k-luoi.c2 { grid-template-columns: 1fr 1fr; }
  .k-luoi.c3 { grid-template-columns: repeat(3, 1fr); }
  .k-luoi.chinh-phu { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
}

.k-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 12px; margin-bottom: 16px; }
.k-kpi { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 14px;
  box-shadow: var(--shadow); color: var(--text); overflow: hidden; }
.k-kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--k-t-chu, var(--brand)); }
.k-kpi span { display: block; color: var(--muted); font-size: 13px; }
.k-kpi b { display: block; font-size: 26px; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--k-t-chu, var(--brand-dark)); }
.k-kpi small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
a.k-kpi:hover { border-color: var(--brand-ring); text-decoration: none; }

/* ============================== 7. NHÃN (chip) 8 TÔNG ============================== */
.k-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; background: var(--t-xam-nen); color: var(--t-xam-chu); vertical-align: middle; }
.k-chip .ic { width: 13px; height: 13px; }
.k-t-xam { --k-t-nen: var(--t-xam-nen); --k-t-chu: var(--t-xam-chu); }
.k-t-la { --k-t-nen: var(--t-la-nen); --k-t-chu: var(--t-la-chu); }
.k-t-duong { --k-t-nen: var(--t-duong-nen); --k-t-chu: var(--t-duong-chu); }
.k-t-tim { --k-t-nen: var(--t-tim-nen); --k-t-chu: var(--t-tim-chu); }
.k-t-cam { --k-t-nen: var(--t-cam-nen); --k-t-chu: var(--t-cam-chu); }
.k-t-do { --k-t-nen: var(--t-do-nen); --k-t-chu: var(--t-do-chu); }
.k-t-vang { --k-t-nen: var(--t-vang-nen); --k-t-chu: var(--t-vang-chu); }
.k-t-ngoc { --k-t-nen: var(--t-ngoc-nen); --k-t-chu: var(--t-ngoc-chu); }
.k-chip[class*="k-t-"], .k-av[class*="k-t-"] { background: var(--k-t-nen); color: var(--k-t-chu); }
.k-cham { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--k-t-chu, var(--faint)); vertical-align: 1px; margin-right: 6px; }
.k-av { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 700; font-size: 13.5px; flex: none;
  background: var(--brand-soft); color: var(--brand-dark); }
.k-av.lon { width: 52px; height: 52px; font-size: 20px; }
.k-av.nho { width: 24px; height: 24px; font-size: 11px; }

/* ============================== 8. Ô NHẬP, FORM ============================== */
.k-o, .k-form input:not([type=checkbox]):not([type=radio]):not([type=file]), .k-form select, .k-form textarea {
  width: 100%; min-height: var(--h); padding: 7px 11px; border: 1px solid var(--line-2); border-radius: var(--bo); background: #fff; color: var(--text);
  font-size: 14.5px; }
.k-o:focus, .k-form input:focus, .k-form select:focus, .k-form textarea:focus { outline: 3px solid var(--brand-ring); outline-offset: 0; border-color: var(--brand); }
.k-o::placeholder, .k-form ::placeholder { color: var(--faint); }
.k-o[aria-invalid="true"], .k-truong.co-loi input, .k-truong.co-loi select, .k-truong.co-loi textarea { border-color: var(--red); }
textarea.k-o, .k-form textarea { resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
input[type=file] { font-size: 13.5px; }
.k-form { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 720px) { .k-form.c2 { grid-template-columns: 1fr 1fr; } .k-form.c3 { grid-template-columns: repeat(3, 1fr); } }
.k-truong { margin-bottom: 14px; min-width: 0; }
.k-truong.rong, .k-form > .rong { grid-column: 1 / -1; }
.k-truong > label, .k-nhan { display: block; font-size: 13.5px; font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
.k-truong > label i { color: var(--red); font-style: normal; }
.k-goi-y { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.k-loi { color: var(--red); font-size: 13px; margin-top: 4px; }
.k-tick { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.k-tick-ds { display: flex; flex-wrap: wrap; gap: 8px; max-height: 280px; overflow-y: auto; }
.k-tick-ds label { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--line-2); border-radius: var(--bo);
  cursor: pointer; background: #fff; font-weight: 400; }
.k-tick-ds label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.k-tick-ds .an { display: none; }
.k-tick-ds div { display: contents; }
.k-loc-nhanh { margin-bottom: 8px; }
.k-form-cuoi { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
@media (max-width: 640px) { .k-o, .k-form input:not([type=checkbox]):not([type=radio]), .k-form select, .k-form textarea { font-size: 16px; min-height: 42px; }
  .k-btn { height: 42px; } .k-btn.k-nho { height: 36px; } }

/* ============================== 9. BỘ LỌC, TAB, ĐOẠN ============================== */
.k-loc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.k-loc .k-o { width: auto; min-width: 140px; flex: 0 1 200px; height: var(--h-sm); min-height: var(--h-sm); font-size: 13.5px; padding: 4px 10px; }
.k-loc .k-o.k-tim-o { flex: 1 1 220px; }
.k-loc-dem { margin-left: auto; color: var(--muted); font-size: 13px; }
.k-tab { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.k-tab::-webkit-scrollbar { display: none; }
.k-tab a { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; color: var(--text-2); white-space: nowrap; font-weight: 500; }
.k-tab a:hover { color: var(--brand); text-decoration: none; }
.k-tab a.on { color: var(--brand); font-weight: 600; }
.k-tab a.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.k-tab a .k-dem { height: 18px; min-width: 18px; font-size: 11.5px; }
.k-tab a.on .k-dem { background: var(--brand-soft); color: var(--brand-dark); }
.k-seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-soft-2); border-radius: 10px; }
.k-seg a, .k-seg button { padding: 5px 12px; border-radius: var(--bo); color: var(--text-2); font-weight: 500; border: 0; background: none; cursor: pointer; font-size: 13.5px; }
.k-seg a:hover { text-decoration: none; color: var(--text); }
.k-seg .on { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow); font-weight: 600; }

/* ============================== 10. BẢNG ============================== */
.k-bang-cuon { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; max-height: calc(100vh - 180px); }
.k-the > .k-bang-cuon { border: 0; border-radius: 0; margin: 0 -18px -16px; max-height: none; }
.k-the.sat > .k-bang-cuon { margin: 0; }
.k-bang { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.k-bang th, .k-bang td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; background: #fff; }
.k-bang thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-soft-2); color: #344054; font-weight: 600; font-size: 13px; white-space: nowrap; }
.k-bang tbody tr:hover td { background: #f7faf5; }
.k-bang tbody tr:last-child td { border-bottom: 0; }
.k-bang tfoot td { font-weight: 700; background: var(--bg-soft); position: sticky; bottom: 0; }
.k-bang .k-dinh-1 { position: sticky; left: 0; z-index: 1; }
.k-bang thead .k-dinh-1 { z-index: 3; }
.k-bang td.k-ten { font-weight: 500; }
.k-bang td.k-ten small, .k-bang td small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.k-bang tr.mo td { color: var(--faint); }
.k-bang a.k-dong-link { color: var(--text); font-weight: 500; }
.k-bang-gon th, .k-bang-gon td { padding: 6px 10px; }
.k-tien-do { display: inline-flex; align-items: center; gap: 6px; min-width: 90px; }
.k-tien-do i { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-soft-2); overflow: hidden; position: relative; min-width: 50px; }
.k-tien-do i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--pt, 0%); background: var(--brand); border-radius: 3px; }
.k-tien-do.kem i::after { background: var(--red); }
.k-tien-do.vua i::after { background: #f79009; }
.k-phan-trang { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px 0; color: var(--muted); font-size: 13px; }

/* danh sách dòng (dùng thay bảng trên điện thoại) */
.k-ds { display: flex; flex-direction: column; }
.k-dong { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--text); }
.k-dong:last-child { border-bottom: 0; }
a.k-dong:hover { background: var(--bg-soft); text-decoration: none; }
.k-dong-giua { flex: 1; min-width: 0; }
.k-dong-giua b { display: block; font-weight: 600; }
.k-dong-giua small { display: block; color: var(--muted); font-size: 13px; }

/* thông tin dạng nhãn - giá trị */
.k-tt { display: grid; grid-template-columns: minmax(110px, 160px) 1fr; gap: 8px 14px; margin: 0; }
.k-tt dt { color: var(--muted); }
.k-tt dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ============================== 11. THÔNG BÁO, RỖNG, TOAST ============================== */
.k-tb { padding: 10px 14px; border-radius: var(--bo); margin-bottom: 10px; font-size: 14px; background: var(--t-la-nen); color: var(--t-la-chu); }
.k-tb-error { background: var(--t-do-nen); color: var(--t-do-chu); }
.k-tb-warning { background: var(--t-vang-nen); color: var(--t-vang-chu); }
.k-tb-info { background: var(--t-duong-nen); color: var(--t-duong-chu); }
/* trạng thái rỗng (không áp cho nút) */
.k-rong:not(.k-btn) { text-align: center; color: var(--muted); padding: 28px 12px; }
.k-rong:not(.k-btn) .ic { width: 30px; height: 30px; color: var(--faint); display: block; margin: 0 auto 8px; }
.k-rong:not(.k-btn) b { display: block; color: var(--text-2); margin-bottom: 2px; }
.k-toast { position: fixed; left: 50%; bottom: calc(var(--duoi-h) + 20px); transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: var(--bo);
  background: var(--text); color: #fff; box-shadow: var(--shadow-pop); font-size: 14px; }

/* ============================== 12. HỘP THOẠI (modal) ============================== */
dialog.k-modal { border: 0; padding: 0; border-radius: 12px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow-pop); color: var(--text); }
dialog.k-modal::backdrop { background: rgba(16, 24, 40, .45); }
.k-modal-dau { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.k-modal-dau h2 { flex: 1; }
.k-modal-than { padding: 16px 18px; overflow-y: auto; max-height: calc(100vh - 170px); }
.k-modal-cuoi { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg-soft); }
@media (max-width: 640px) { dialog.k-modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 14px 14px 0 0; } }

/* ============================== 13. DÒNG THỜI GIAN ============================== */
.k-dtg { list-style: none; margin: 0; padding: 0; position: relative; }
.k-dtg::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.k-dtg li { position: relative; padding: 0 0 16px 34px; }
.k-dtg li:last-child { padding-bottom: 0; }
.k-dtg-cham { position: absolute; left: 4px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--k-t-chu, var(--brand)); }
.k-dtg-dau { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.k-dtg-dau b { color: var(--text); font-size: 14px; }
.k-dtg-noi { margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }
.k-dtg-noi .k-the { margin: 6px 0 0; padding: 10px 12px; }

/* ============================== 14. HỒ SƠ HỌC VIÊN ============================== */
.k-hs-dau { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.k-hs-dau h1 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.k-hs-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.k-hs-meta span { display: inline-flex; align-items: center; gap: 5px; }
.k-hs-meta .ic { width: 15px; height: 15px; }

/* ============================== 15. TRANG ĐỘC LẬP: đăng nhập, phụ huynh ============================== */
.k-trang-don { min-height: 100vh; background: radial-gradient(circle at 12% 8%, var(--lime-soft) 0 140px, transparent 141px),
  linear-gradient(180deg, var(--brand-soft), var(--bg) 340px); }
.k-hoa-tiet { position: fixed; inset: 0; pointer-events: none; color: var(--brand); opacity: .06; font: 700 46px/1 Georgia, serif; overflow: hidden; }
.k-hoa-tiet span { position: absolute; }
.k-hop-dn { max-width: 380px; margin: 0 auto; padding: 56px 18px; }
.k-hop-dn .k-logo { display: block; margin: 0 auto; width: 84px; height: 84px; border-radius: 50%; box-shadow: 0 6px 20px rgba(19, 108, 64, .25); }
.k-hop-dn h1 { text-align: center; color: var(--brand); margin: 12px 0 2px; }
.k-hop-dn > p { text-align: center; color: var(--muted); margin: 0 0 18px; }
.k-hop-dn .k-the { position: relative; border-radius: 16px; }
.k-dai-mau { background: var(--brand-dark); color: #fff; padding: 18px; display: flex; gap: 14px; align-items: center; }
.k-dai-mau img { width: 52px; height: 52px; border-radius: 12px; background: #fff; padding: 4px; }
.k-dai-mau small { color: #d9ebd0; display: block; }

/* ============================== 16. ĐIỆN THOẠI ============================== */
@media (max-width: 640px) {
  h1 { font-size: 19px; }
  .k-an-dt { display: none !important; }
  .k-the { padding: 14px; border-radius: 12px; }
  .k-the > .k-bang-cuon { margin: 0 -14px -14px; }
  .k-tt { grid-template-columns: 110px 1fr; }
  .k-chon-cs { max-width: 120px; }
  .k-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .k-kpi b { font-size: clamp(16px, 5.2vw, 22px); white-space: nowrap; }
  /* thanh chọn kiểu (k-seg) nhiều mục: cuộn ngang, chữ không gãy */
  .k-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .k-seg::-webkit-scrollbar { display: none; }
  .k-seg a, .k-seg button { white-space: nowrap; flex: none; }
  /* bảng nhiều cột: giữ bề rộng tối thiểu để kéo ngang thay vì bóp chữ thành cột dọc (cột tên k-dinh-1 dính trái) */
  .k-bang-cuon > .k-bang:has(thead th:nth-child(4)) { min-width: 600px; }
  .k-bang-cuon > .k-bang:has(thead th:nth-child(6)) { min-width: 780px; }
  .k-bang-cuon > .k-bang:has(thead th:nth-child(4)) td { min-width: 76px; }
  .k-bang-cuon > .k-bang:has(thead th:nth-child(4)) td:first-child { min-width: 140px; }
  .k-bang-cuon > .k-bang.k-bang-hep { min-width: 0; }
  .k-bang .k-dinh-1 { max-width: 150px; }
  .k-bang td .k-nut-hang { flex-wrap: nowrap; }  /* nút trong ô bảng nằm một hàng, bảng kéo ngang */
  .k-chon-cs { max-width: 104px; }
}
@media (min-width: 641px) { .k-chi-dt { display: none !important; } }
/* ---- dùng chung từ phiên ghép (gom lớp riêng các app trùng chức năng) ---- */
/* lưới ảnh nhỏ (ảnh cam kết, ảnh bài test…) */
.k-anh-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 6px; }
.k-anh-luoi a { display: block; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); }
.k-anh-luoi img { width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: var(--r-sm); background: var(--bg-soft); }
.k-anh-luoi figure { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.k-anh-luoi .k-anh-tep { display: flex; align-items: center; justify-content: center; font-size: 12px; padding: 6px; text-align: center; height: 100%; }
/* số tiền: không xuống dòng, chữ số thẳng cột; âm đỏ; dòng đã huỷ gạch */
.k-tien { font-variant-numeric: tabular-nums; white-space: nowrap; }
.k-am { color: var(--t-do-chu); }
.k-gach { text-decoration: line-through; opacity: .6; }
/* hộp gợi ý hành động (nền lime) */
.k-hop-goi-y { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: var(--lime-soft);
  border-radius: var(--bo); padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.k-hop-goi-y span { display: inline-flex; gap: 6px; align-items: center; }

@media print { .k-sb, .k-top, .k-duoi, .k-che { display: none !important; } .k-main { margin: 0; padding: 0; } }
.k-mt { margin-top: 8px; }
.k-mb { margin-bottom: 8px; }
.k-the[class*="k-t-"] { background: var(--k-t-nen); border-color: transparent; box-shadow: none; }
.k-ma { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg-soft-2); border-radius: var(--r-sm); padding: 10px 12px; white-space: pre-wrap; overflow-x: auto; color: var(--text-2); margin: 8px 0 0; }
.k-the.sat > .k-loc { padding: 0 18px; }
.k-the.sat > .k-ma { margin: 0; border-radius: 0; }
.k-btn.k-pill { border-radius: 999px; }

/* thông báo gộp theo loại / ngày (core/thong_bao.html) */
details.k-tb-nhom { display: block; padding: 0; }
details.k-tb-nhom > summary { display: flex; align-items: center; gap: 12px; padding: 10px 4px; cursor: pointer; list-style: none; }
details.k-tb-nhom > summary::-webkit-details-marker { display: none; }
details.k-tb-nhom > .k-ds { padding-left: 24px; background: var(--bg-soft); }

/* ô tiền (TienInput) canh phải để đọc số dễ */
input[data-tien] { text-align: right; font-variant-numeric: tabular-nums; }

/* bảng thành thẻ trên điện thoại: <table class="k-bang k-bang-the">, mỗi <td data-nhan="Deadline">.
   Ô quan trọng (tên, deadline, trạng thái) thấy ngay không cần kéo ngang; ô k-an-dt vẫn ẩn. */
@media (max-width: 640px) {
  .k-bang-cuon > .k-bang.k-bang-the { min-width: 0 !important; }
  .k-bang.k-bang-the thead { display: none; }
  .k-bang.k-bang-the tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .k-bang.k-bang-the tbody td { display: block; padding: 2px 0; border: 0; min-width: 0 !important; max-width: none !important; position: static; background: transparent; }
  .k-bang.k-bang-the tbody td[data-nhan]::before { content: attr(data-nhan); display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
  .k-bang.k-bang-the tbody td.k-dinh-1, .k-bang.k-bang-the tbody td.k-the-rong, .k-bang.k-bang-the tbody td[colspan] { grid-column: 1 / -1; }
  .k-bang.k-bang-the tbody td.k-dinh-1 { font-size: 15px; }
  .k-bang.k-bang-the tbody td.k-dinh-1::before { display: none; }
  .k-bang.k-bang-the tbody tr:hover td { background: transparent; }
}

/* điện thoại: trình duyệt tự cuộn ô đang gõ lên trên thanh Lưu dính đáy + thanh điều hướng (kitto.js choKhoiChe) */
@media (max-width: 1023px) { input, textarea, select { scroll-margin-bottom: 170px; scroll-margin-top: 72px; } }

/* ô chọn người phụ trách: tick "Hiện tất cả" (core.forms.ChonNguoiPhuTrach) */
.k-hien-tat-ca { margin-top: 4px; font-weight: 400; }
