/* BK Study Library. Thư viện tra theo môn: mã môn là nhãn gáy sách, thứ duy nhất được làm nổi.
   Một bộ quy tắc cho mọi thành phần: bo góc --radius (nhãn 4 px), viền 1 px đều bốn cạnh, không vạch màu
   một bên, không gạch dưới làm dấu trạng thái, không đổ bóng; nút và ô cao 40 hoặc 44 px; đang chọn là nền
   --brand chữ --on-brand đậm 600; rê chuột là nền --surface-2; bàn phím là vòng --ring.
   Màu thương hiệu đo từ logo HCMUT: xanh trời #1488DB (nền), xanh đậm #032B91 (chữ).
   Font hệ thống, không tải font từ mạng. */

:root {
  color-scheme: light dark;
  --brand: #1488db;
  --brand-navy: #032b91;
  --on-brand: #0d1622;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1c2430;
  --muted: #586374;
  --border: #dde2e9;
  --border-strong: #b9c2ce;
  /* Nhấn: viền, vòng focus. Chữ link dùng --link (nền sáng cùng màu với --accent). */
  --accent: #0f6fb5;
  --accent-soft: #e3f1fb;
  --link: #0f6fb5;
  --link-hover: #0b5a94;
  /* Nút chính: một nút mỗi khối. */
  --primary-bg: var(--brand-navy);
  --primary-hover: #0a3bb0;
  --primary-text: #ffffff;
  /* Đang chọn: mục điều hướng hiện tại, chip đang chọn. */
  --selected-bg: var(--brand);
  --selected-text: var(--on-brand);
  --warn: #8a3707;
  --warn-soft: #fdf6f3;
  --focus: #0f6fb5;
  --ring: rgba(20, 136, 219, 0.3);
  --code-bg: #e3f1fb;
  --code-text: var(--brand-navy);
  --radius: 8px;
  --control-h: 44px;
  --control-h-sm: 40px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151a21;
    --surface: #1c232c;
    --surface-2: #252e39;
    --text: #e9eef4;
    --muted: #a6b0bd;
    --border: #2d3743;
    --border-strong: #46525f;
    --accent: #1488db;
    --accent-soft: #132a40;
    /* #1488DB trên --surface chỉ đạt 4.2: chữ link dùng sắc nhạt hơn để đạt 4.5 trên mọi nền. */
    --link: #3a9de3;
    --link-hover: #5aace8;
    --primary-bg: var(--brand);
    --primary-hover: #3a9de3;
    --primary-text: var(--on-brand);
    --warn: #f4bfab;
    --warn-soft: #3b1f14;
    --focus: #1488db;
    --ring: rgba(20, 136, 219, 0.4);
    --code-bg: rgba(20, 136, 219, 0.22);
    --code-text: #cfe6f8;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.skip {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  z-index: 10;
}
.skip:focus { top: 8px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Thanh trên */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text span { color: var(--muted); font-size: 12px; }
.nav ul { display: flex; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: flex;
  align-items: center;
  min-height: var(--control-h-sm);
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--selected-bg); color: var(--selected-text); font-weight: 600; }
.nav .lang { color: var(--muted); }

main { flex: 1 0 auto; width: 100%; outline: none; }
/* main cũng có class .wrap (padding: 0 16px) nên khoảng trên, dưới phải đặt riêng để không bị ghi đè. */
main.wrap { padding-top: 20px; padding-bottom: 40px; }

h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 12px; font-weight: 600; }
h2 { font-size: 20px; margin: 28px 0 10px; font-weight: 600; }
h3 { font-size: 16px; margin: 20px 0 8px; font-weight: 600; }
h4 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
.code {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.86em;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding: 1px 7px;
  border-radius: 4px;
  color: var(--code-text);
  background: var(--code-bg);
  white-space: nowrap;
}
h1 .code { font-size: 0.62em; vertical-align: 0.28em; margin-right: 6px; }

/* Ô nhập và ô chọn: một kiểu cho cả trang, viền đều bốn cạnh, bấm vào thì có vòng sáng màu nhấn */
.search input, .search select, .upload input[type="text"], .upload input[type="email"], .upload input[type="search"], .upload select, .upload textarea {
  width: 100%;
  min-height: var(--control-h);
  font: inherit;
  font-size: 16px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.upload textarea { min-height: 96px; }
.search input:hover, .search select:hover, .upload input[type="text"]:hover, .upload input[type="email"]:hover, .upload input[type="search"]:hover, .upload select:hover, .upload textarea:hover { border-color: var(--muted); }
.search input:focus, .search select:focus, .upload input:focus, .upload select:focus, .upload textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.search input:disabled, .search select:disabled, .upload input:disabled, .upload select:disabled { opacity: 0.6; }
::placeholder { color: var(--muted); opacity: 0.8; }
@media (prefers-reduced-motion: reduce) { .search input, .search select, .upload input, .upload select, .upload textarea { transition: none; } }

.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 400; }
.lead { font-size: 17px; }

.crumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; padding: 0 8px; color: var(--border-strong); }

.hero { max-width: 760px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* Ghi chú: hộp nền nhạt viền đều, không có vạch màu bên trái. */
.note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius);
}
.note.warn { background: var(--warn-soft); border-color: var(--warn); }
.note p { margin: 0; }

/* Tìm kiếm */
.search { margin: 20px 0 8px; max-width: 760px; }
.search label { display: block; font-weight: 600; margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1 1 auto; min-width: 0; }
.search-row select { flex: 0 0 auto; width: auto; max-width: 40%; }
@media (max-width: 560px) {
  .search-row { flex-direction: column; }
  .search-row select { width: 100%; max-width: none; }
}
.results { list-style: none; margin: 0; padding: 0; }
.results li { border-bottom: 1px solid var(--border); }
.results a { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 4px; text-decoration: none; color: var(--text); }
.results a:hover { background: var(--surface-2); }
.results .code { min-width: 72px; text-align: center; }
.results li.muted { padding: 8px 4px; border-bottom: 0; }
/* Nhãn bậc (Thạc sĩ, Tiến sĩ) cuối dòng kết quả môn: khoảng cách theo gap của dòng. */
.results a > .tag { margin-left: 0; align-self: center; }
.results-head { font-size: 15px; margin: 12px 0 4px; }
#q-prog + #q-status { margin-top: 16px; }
#q-status { min-height: 1.55em; }
.search.from-url #q-out { min-height: 80vh; }
/* Đích của link tới khối (trang chương trình) hoặc nhóm loại (trang môn) */
.block:target, .group:target { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: var(--radius); }
.block, .group { scroll-margin-top: 16px; }

/* Lưới khoa */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.card:hover { background: var(--surface-2); color: var(--text); }
.card .muted { font-size: 13px; }

.list { padding-left: 20px; }
.list li { margin: 4px 0; }

.cta-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 28px; }
.cta-row p { margin: 0; }
.cta-row p + p { margin-top: 12px; }

/* Nút */
.btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h-sm);
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-text); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-text); }
.btn.subtle { border-color: transparent; background: transparent; color: var(--link); }
.btn.subtle:hover { background: var(--surface-2); color: var(--link-hover); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
/* Khối ngay sau ghi chú luôn cách 12 px. */
.note + * { margin-top: 12px; }
/* Khối chữ hay danh sách ngay trên hàng nút không thêm lề dưới: hàng nút luôn cách 12 px. */
:is(p, ul, ol):has(+ .actions) { margin-bottom: 0; }

/* Bảng */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.retired td, tr.retired th { color: var(--muted); }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  vertical-align: 1px;
  margin-left: 6px;
}
.tag.accent { background: var(--accent-soft); color: var(--link); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* Thông tin môn */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; margin: 12px 0 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.facts div { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.item p { margin: 4px 0; }
.item .meta { font-size: 13px; color: var(--muted); }
/* Chi tiết tài liệu: từng cặp nhãn, giá trị; nhiều cặp một hàng trên máy tính, một cột trên điện thoại. */
.item-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 24px; margin: 10px 0 0; font-size: 14px; }
.item-facts div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; min-width: 0; }
.item-facts dt { color: var(--muted); }
.item-facts dd { margin: 0; overflow-wrap: anywhere; }
.item-facts dd .code { margin-right: 6px; }

/* Dòng mã của trang môn và bộ lọc tài liệu theo mã, theo loại */
.codes { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.code-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.doc-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.doc-filters[hidden] { display: none; }
.doc-filters .filter { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.doc-filters label { font-size: 13px; color: var(--muted); font-weight: 600; }
.doc-filters select {
  min-height: var(--control-h);
  font: inherit;
  font-size: 16px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.doc-filters select:hover { border-color: var(--muted); }
.doc-filters select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
#f-status { flex-basis: 100%; margin: 0; }
@media (max-width: 560px) {
  .doc-filters .filter { min-width: 0; flex: 1 1 100%; }
  .item-facts div { grid-template-columns: 96px minmax(0, 1fr); }
}
/* Nhiều file: mỗi file một dòng, tên, định dạng và cỡ, rồi nút riêng. */
.files { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--border); }
.files li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.files .file-name { font-weight: 600; overflow-wrap: anywhere; }
.files .actions { margin-top: 8px; }
/* Hàng nút của mục: Xem trước, Tải xuống, Yêu cầu gỡ. */
.item .actions { margin: 12px 0 0; }
/* Mở từ link có #<id mục> (ví dụ link trong form Yêu cầu gỡ): viền nhấn để thấy ngay mục nào. */
.item:target { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.contribute { margin-top: 28px; }
.contribute h2 { margin-top: 0; }

.prose { max-width: 760px; }
.prose li { margin: 4px 0; }
.prose code, code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.92em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }

.foot { border-top: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--muted); }
.foot .wrap { padding-top: 16px; padding-bottom: 24px; }
.foot p { margin: 4px 0; }

@media (max-width: 600px) {
  h1 { font-size: 23px; }
  .brand-text span { display: none; }
  .nav a { padding: 6px 8px; }
  th, td { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  .top, .foot, .search, .contribute, .cta-row { display: none; }
}

/* Form gửi tài liệu */
.upload fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.upload .field { margin: 0 0 18px; }
.upload label { display: block; font-weight: 600; margin: 10px 0 4px; }
.upload .field > label:first-child { margin-top: 0; }
.upload input[type="file"] { width: 100%; font: inherit; padding: 8px 10px; color: var(--text); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.upload input[type="file"]:focus-visible, .upload summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Đợt gửi nhiều file: mỗi file một khối có tiêu đề và loại riêng. */
.upload ol.batch { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.upload ol.batch li { padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.upload .batch-file { margin: 0 0 4px; font-weight: 600; overflow-wrap: anywhere; }
.upload ul.sent { margin: 8px 0 0; padding-left: 20px; font-size: 13px; }
.upload ul.sent li { margin: 4px 0; overflow-wrap: anywhere; }
.upload label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 8px 0; min-height: 24px; padding: 2px 0; }

.upload .book { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.upload .book[hidden] { display: none; }
/* Môn mới (khi tìm không thấy môn): khung như ô sách, lời mời có nút nhẹ cùng hàng. */
.upload .new-course { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.upload .new-course[hidden], .upload .new-offer[hidden] { display: none; }
.upload .new-course .actions { margin: 12px 0 0; }
.upload .new-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--muted); }
.upload .pick li.muted + li button { border-top: 1px solid var(--border); }
.upload .pick li + li.muted { margin-top: 8px; }
/* Mã môn của môn nhiều mã: ô chọn nhỏ ngay dưới ô môn, chỉ hiện khi có từ 2 mã. */
.upload .code-pick { margin-top: 12px; }
.upload .code-pick[hidden], .upload #teacher-pick-box[hidden], .upload #teacher-text-box[hidden] { display: none; }
.upload #teacher-pick-box + #teacher-text-box { margin-top: 12px; }
.upload .more { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.upload .more summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.upload .muted, .upload .err { margin: 4px 0 0; }
.upload .err { color: var(--warn); font-weight: 600; }
.upload .err:empty { display: none; }
.upload .pick { list-style: none; margin: 4px 0 0; padding: 0; }
.upload .pick button { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; min-height: var(--control-h); text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-top: 0; padding: 8px 10px; cursor: pointer; }
.upload .pick li:first-child button { border-top: 1px solid var(--border); }
.upload .pick button:hover, .upload .pick button:focus-visible { background: var(--surface-2); }
.upload fieldset:disabled { opacity: 0.6; }
.upload label.check input { width: 18px; height: 18px; flex: none; margin-top: 2px; accent-color: var(--accent); }
/* Nhãn đứng cạnh nhau hoặc cạnh tiêu đề luôn có khoảng cách. */
.item.is-removed h4, .item.is-removed .meta { color: var(--muted); }
/* Trang chủ yếu là chữ: thu khung về đúng cột đọc để cả đường dẫn, tiêu đề, nội dung nằm giữa trang. */
main.wrap:has(> .prose) { max-width: 792px; }
.hero, .search { margin-left: auto; margin-right: auto; }

/* Chương trình gộp theo khoa (trang chủ) */
.prog-groups { border-top: 1px solid var(--border); margin: 8px 0 12px; }
.prog-fac { border-bottom: 1px solid var(--border); }
.prog-fac summary { cursor: pointer; padding: 10px 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.prog-fac summary:hover { background: var(--surface-2); }
.prog-fac summary:focus-visible, .facts summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.prog-fac-name { font-weight: 600; }
.prog-fac > .list, .prog-fac > p { margin: 0 0 10px; }
.prog-fac > p.muted { padding: 0 4px; }
.block p.small { margin: -4px 0 8px; }
.facts summary { cursor: pointer; padding: 6px 0; }
/* Chương trình có môn (trang môn một mã): gập trong một dòng. */
.course-progs { margin: 12px 0 0; }
/* Bảng môn dài: môn chưa có tài liệu gập dưới bảng môn có tài liệu. */
.no-docs { margin: 12px 0 0; }
.no-docs > summary { cursor: pointer; font-weight: 600; padding: 8px 4px; min-height: 24px; }
.no-docs > summary:hover { background: var(--surface-2); }
.no-docs > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.no-docs > .table-wrap { margin-top: 8px; }
.course-progs > summary { cursor: pointer; color: var(--muted); padding: 4px 0; min-height: 24px; }
.course-progs > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.course-progs ul { margin: 4px 0 0; padding-left: 20px; }
/* Mã chương trình và tên dài không có khoảng trắng: xuống dòng thay vì làm trang cuộn ngang. */
main h1, main h2, main p, main li { overflow-wrap: break-word; }
.more-items { margin-top: 10px; }
.more-items > summary { cursor: pointer; font-weight: 600; color: var(--link); padding: 4px 0; }
.more-items > .items { margin-top: 10px; }

/* Bộ lọc và kết quả tài liệu ở ô tìm trang chủ */
.search-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.search .search-filters label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.search .search-filters select { width: 100%; max-width: none; }
@media (max-width: 560px) {
  .search-filters { grid-template-columns: 1fr; }
}
#q-docs-status { margin: 0 0 4px; }
.results .doc-title { font-weight: 600; }
.results .doc-desc { flex-basis: 100%; font-size: 13px; }

/* Ngành: một dòng mỗi ngành (tên, nhãn loại, các khóa) ở trang chủ và trang khoa */
.majors { list-style: none; margin: 0 0 12px; padding: 0; }
.major-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 4px; border-top: 1px solid var(--border); }
.major-row:first-child { border-top: 0; }
.major-head { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.major-head .tag { margin-left: 0; }
/* Tên ngành là phần tử flex nên không còn là link nội dòng: đệm cho vùng bấm đủ 24 px. */
.major-name { font-weight: 600; padding: 2px 0; }
.prog-fac > h3 { margin: 12px 4px 4px; font-size: 15px; }
.prog-empty { margin: 4px 0 10px; }
.prog-empty > summary { cursor: pointer; color: var(--muted); padding: 4px; min-height: 24px; }
.prog-empty > summary:focus-visible, .sem-rest > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.tags .tag { margin-left: 0; }

/* Bộ chọn loại chương trình và khóa: link dạng chip */
.pickers { display: grid; gap: 8px; margin: 12px 0 0; }
.pick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pick-label { font-size: 13px; color: var(--muted); min-width: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h-sm);
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip[aria-current] { border-color: var(--selected-bg); background: var(--selected-bg); color: var(--selected-text); font-weight: 600; }

/* Lộ trình theo học kỳ */
.sem { margin-top: 20px; scroll-margin-top: 16px; }
.sem h3 { margin: 0 0 8px; }
.sem-rest { margin-top: 8px; }
.sem-rest > summary { cursor: pointer; font-weight: 600; padding: 4px 0; min-height: 24px; }
.sem-rest > .table-wrap { margin-top: 8px; }

/* Nhãn loại chương trình là link mở ô tìm trang chủ (?q=<loại>): giữ dáng .tag, vùng bấm 24 px, có focus. */
a.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; text-decoration: none; vertical-align: baseline; }
a.tag:hover { color: var(--text); background: var(--border); }
a.tag:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Môn theo tên: một dòng mỗi môn (tên, các mã) ở ô tìm trang chủ và form gửi; dòng mã dưới tên trang môn */
.row-title { font-weight: 600; }
.row-codes { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.results .row-codes .code { min-width: 0; }

/* Tài liệu mới ở trang chủ */
.recent { margin: 28px 0; }
.recent-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.recent-list li { border-bottom: 1px solid var(--border); }
.recent-list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 10px 4px; text-decoration: none; color: var(--text); }
.recent-list a:hover { background: var(--surface-2); }
.recent-list a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.recent-title { font-weight: 600; color: var(--link); grid-column: 1; }
.recent-course { grid-column: 1; font-size: 14px; color: var(--text); }
.recent-course .code { margin-right: 6px; }
.recent-meta { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; white-space: nowrap; }
.recent-date { grid-column: 2; grid-row: 2; text-align: right; font-size: 13px; white-space: nowrap; }
@media (max-width: 560px) {
  .recent-title, .recent-course { grid-column: 1 / -1; }
  .recent-meta { grid-column: 1; grid-row: 3; text-align: left; white-space: normal; }
  .recent-date { grid-column: 2; grid-row: 3; }
}
/* Ghi chú viết tắt loại chương trình dưới danh sách ngành. */
.abbr-note { margin: 12px 0 0; font-size: 0.875rem; }
.abbr-note summary { cursor: pointer; color: var(--muted); }
.abbr-note dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0; }
.abbr-note dt { font-weight: 600; }
.abbr-note dd { margin: 0; }
