/* documents.css — phần đặc thù của module "documents" (văn bản và công khai; mọi thể hiện kể cả module ảo).
   Các lớp nền (mt-card, mt-stack, mt-filter, mt-chip, mt-badge, mt-file, mt-dl, mt-list, mt-empty, mt-pagination, ...) do hệ thiết kế của
   theme định nghĩa (docs/architecture.md mục 8.3); tệp này chỉ bổ sung bố cục của các lớp mt-doc-* và dùng token --mt-* (có giá trị dự phòng
   để không vỡ khi theme chưa nạp token). Không URL ngoài, không @import. */

/* ---------- Trang danh sách ---------- */
.mt-doc-list__intro {
  margin: 0 0 1rem;
  color: var(--mt-text-muted, #576F8F);
}

.mt-doc-chips {
  margin-bottom: 1rem;
}

.mt-doc-filter {
  margin-bottom: 1rem;
}

.mt-doc-filter__q {
  flex: 2 1 16rem;
  min-width: 0;
}

.mt-doc-filter .mt-help {
  margin: 0.25rem 0 0;
}

.mt-doc-list__count {
  margin: 0 0 0.75rem;
  color: var(--mt-text-muted, #576F8F);
  font-size: var(--mt-fs-sm, 0.9375rem);
}

.mt-doc-cards {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.875rem;
}

.mt-doc-cards__item {
  min-width: 0;
}

.mt-doc-card {
  border: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 0.5rem;
  background: var(--mt-bg-card, #FFFFFF);
}

.mt-doc-card .mt-card__body {
  display: grid;
  gap: 0.375rem;
  padding: 0.875rem 1rem;
}

.mt-doc-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.625rem;
  margin: 0;
}

.mt-doc-card__number {
  font-weight: 700;
  color: var(--mt-primary-strong, #082D7F);
  overflow-wrap: anywhere;
}

.mt-doc-card .mt-card__title {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mt-doc-card__issuer {
  margin: 0;
}

.mt-doc-card__files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.mt-doc-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 999px;
  color: var(--mt-primary, #0D46A6);
  font-size: var(--mt-fs-sm, 0.9375rem);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.mt-doc-chip:hover,
.mt-doc-chip:focus {
  background: var(--mt-bg-soft, #EAF1FB);
  text-decoration: underline;
}

.mt-doc-list__pagination {
  margin-top: 1.25rem;
}

/* ---------- Trang chi tiết ---------- */
.mt-doc__badges {
  margin: 0 0 1rem;
}

/* Một cột ở mọi khung nhìn: vùng nội dung của layout "main" đã hẹp vì có cột phụ; bảng thông tin cần đủ rộng để ngày không bị ngắt dòng */
.mt-doc__grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}

.mt-doc__h {
  margin: 0 0 0.75rem;
  font-size: var(--mt-fs-lg, 1.125rem);
  color: var(--mt-primary-strong, #082D7F);
}

.mt-doc__info .mt-dl dd {
  overflow-wrap: anywhere;
}

.mt-doc__files .mt-file {
  margin-bottom: 0.625rem;
}

.mt-doc-preview {
  margin-top: 1rem;
  border: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 0.5rem;
  background: var(--mt-bg-card, #FFFFFF);
}

.mt-doc-preview > summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 2.75rem;
}

.mt-doc-preview .mt-help {
  margin: 0 1rem 0.5rem;
}

.mt-doc-preview__frame {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 24rem;
  border: 0;
  border-top: 1px solid var(--mt-border, #C9D2DD);
  background: #FFFFFF;
}

.mt-doc__source {
  margin: 1.25rem 0 0;
}

.mt-doc__back {
  margin: 1rem 0 0;
}

/* ---------- Khối "Văn bản mới" ---------- */
.mt-doc-block__more {
  margin: 0.75rem 0 0;
}

/* ---------- In ấn ---------- */
@media print {
  .mt-doc-filter,
  .mt-doc-chips,
  .mt-doc-list__pagination,
  .mt-doc-preview,
  .mt-doc__back {
    display: none !important;
  }

  .mt-doc-card {
    break-inside: avoid;
  }
}

/* =====================================================================================================================
   Phân hệ "Công khai giáo dục" (disclosure) — chỉ bổ sung phần đặc thù; thành phần nền (mt-card, mt-badge, mt-table, mt-dl, mt-file, mt-filter...)
   do hệ thiết kế của theme định nghĩa. Có giá trị dự phòng cho token để không vỡ khi theme chưa nạp token.
   ===================================================================================================================== */

.mt-dis__intro,
.mt-dis__lead {
  margin: 0 0 1rem;
  color: var(--mt-text-muted, #576F8F);
  max-width: 62rem;
}

.mt-dis__basis {
  margin: 0 0 0.5rem;
  color: var(--mt-text-muted, #576F8F);
  font-size: var(--mt-fs-sm, 0.9375rem);
}

.mt-dis__h2 {
  margin: 1.5rem 0 0.75rem;
  font-size: var(--mt-fs-xl, 1.25rem);
  color: var(--mt-primary-strong, #082D7F);
}

.mt-dis__h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: var(--mt-fs-lg, 1.125rem);
  color: var(--mt-primary-strong, #082D7F);
}

.mt-dis__note,
.mt-dis__cond {
  max-width: 62rem;
}

.mt-dis__nav,
.mt-dis__back {
  margin: 1.25rem 0 0;
}

.mt-dis-code {
  display: inline-block;
  padding: 0.0625rem 0.4375rem;
  border: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 0.25rem;
  background: var(--mt-bg-soft, #EAF1FB);
  color: var(--mt-primary-strong, #082D7F);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.mt-dis-codebadge {
  vertical-align: middle;
  font-size: 0.75rem;
}

.mt-dis-filter {
  margin: 0 0 1rem;
}

.mt-dis-filter__q {
  flex: 2 1 14rem;
  min-width: 0;
}

.mt-dis-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
  justify-content: space-between;
}

.mt-dis-toolbar__actions {
  margin: 0 0 1rem;
}

/* ---------- Lưới "Tìm nhanh" và "Nổi bật" ---------- */
.mt-dis-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 0 1.5rem;
}

@media (min-width: 56rem) {
  .mt-dis-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.mt-dis-quicklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mt-dis-highlight__report {
  margin: 0 0 0.75rem;
}

.mt-dis-latest {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mt-dis-empty {
  margin: 0.5rem 0;
  color: var(--mt-text-muted, #576F8F);
}

/* ---------- Huy hiệu trạng thái: luôn có chữ + biểu tượng; phân biệt không chỉ bằng màu ---------- */
.mt-dis-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 100%;
  white-space: normal;
}

.mt-dis-ico {
  flex: 0 0 auto;
}

.mt-dis-ico--glyph {
  display: inline-block;
  min-width: 1em;
  font-weight: 700;
  text-align: center;
  line-height: 1;
}

.mt-dis-chip--partial {
  border: 1px dashed currentColor;
}

.mt-dis-chip--updating {
  border: 1px solid currentColor;
  font-style: italic;
}

.mt-dis-chip--notyet {
  border: 1px solid var(--mt-border, #C9D2DD);
  background: var(--mt-bg-card, #FFFFFF);
  color: var(--mt-text, #1E2C58);
}

.mt-dis-chip--na {
  border: 1px solid var(--mt-border, #C9D2DD);
}

.mt-dis-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.mt-dis__legend-label {
  margin: 0 0 0.25rem;
  color: var(--mt-text-muted, #576F8F);
  font-size: var(--mt-fs-sm, 0.9375rem);
}

/* ---------- Ma trận mục × năm học ---------- */
.mt-dis-group {
  margin: 0 0 1rem;
  border: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 0.5rem;
  background: var(--mt-bg-card, #FFFFFF);
}

.mt-dis-group > summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--mt-primary-strong, #082D7F);
  cursor: pointer;
}

.mt-dis-group__count {
  font-weight: 400;
  color: var(--mt-text-muted, #576F8F);
  font-size: var(--mt-fs-sm, 0.9375rem);
}

.mt-dis-group .mt-table-wrap {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 0 0 0.5rem 0.5rem;
}

.mt-dis-table th,
.mt-dis-matrix th {
  white-space: normal;
  vertical-align: top;
}

.mt-dis-matrix {
  min-width: 36rem;
}

.mt-dis-item a {
  text-decoration: none;
  font-weight: 600;
}

.mt-dis-item a:hover,
.mt-dis-item a:focus {
  text-decoration: underline;
}

.mt-dis-row--sub th.mt-dis-item {
  padding-left: 1.75rem;
  font-weight: 400;
}

.mt-dis-row--parent th {
  background: var(--mt-bg-soft, #EAF1FB);
}

.mt-dis-basis {
  color: var(--mt-text-muted, #576F8F);
  font-size: 0.875rem;
}

.mt-dis-cell {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

a.mt-dis-cell:hover .mt-dis-chip__text,
a.mt-dis-cell:focus .mt-dis-chip__text {
  text-decoration: underline;
}

.mt-dis-cell__date,
.mt-dis-cell__note,
.mt-dis-cell__mark {
  display: block;
  color: var(--mt-text-muted, #576F8F);
  font-size: 0.8125rem;
}

.mt-dis-older,
.mt-dis-footlinks {
  margin: 1rem 0;
}

.mt-dis-footlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

.mt-dis-na {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 0.5rem;
}

.mt-dis-na > summary {
  min-height: 2.5rem;
  padding: 0.5rem 0;
  cursor: pointer;
  font-weight: 600;
}

.mt-dis-list {
  margin: 0.25rem 0;
  padding-left: 1.25rem;
}

/* ---------- Trang mục ---------- */
.mt-dis-section {
  margin: 0 0 2rem;
}

.mt-dis-status {
  margin: 0 0 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--mt-border, #C9D2DD);
  border-left-width: 0.375rem;
  border-radius: 0.5rem;
  background: var(--mt-bg-card, #FFFFFF);
}

.mt-dis-status--published {
  border-left-color: var(--mt-success, #1F7A3E);
}

.mt-dis-status--partial,
.mt-dis-status--updating {
  border-left-color: var(--mt-accent, #FAD233);
}

.mt-dis-status__chip,
.mt-dis-status__text {
  margin: 0 0 0.5rem;
}

.mt-dis-status__dl {
  margin: 0.5rem 0 0;
}

.mt-dis-status__links {
  margin: 0.75rem 0 0;
}

.mt-dis-block {
  margin: 0 0 1.25rem;
}

.mt-dis-campus {
  margin: 1rem 0 0.5rem;
}

.mt-dis-week {
  margin: 0.5rem 0;
  font-weight: 600;
}

.mt-dis-history {
  margin: 1rem 0;
  border: 1px solid var(--mt-border, #C9D2DD);
  border-radius: 0.5rem;
  padding: 0 1rem;
}

.mt-dis-history > summary {
  min-height: 2.5rem;
  padding: 0.625rem 0;
  font-weight: 600;
  cursor: pointer;
}

.mt-dis-history .mt-table-wrap {
  margin: 0 0 1rem;
}

.mt-dis-org {
  margin: 0.25rem 0;
  padding-left: 1.25rem;
}

.mt-dis-faq {
  margin: 0 0 1rem;
}

.mt-dis__note {
  color: var(--mt-text-muted, #576F8F);
}

/* ---------- Bảng số liệu: số căn phải, hai chế độ scroll / stack dùng được từ 320 px ---------- */
.mt-dis-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mt-dis-table__total th,
.mt-dis-table__total td {
  font-weight: 700;
  background: var(--mt-bg-soft, #EAF1FB);
}

.mt-dis-tablewrap {
  max-width: 100%;
}

.mt-dis-tablewrap:focus {
  outline: 3px solid var(--mt-focus, #0D46A6);
  outline-offset: 2px;
}

/* chế độ scroll: cột đầu (nhãn hàng) cố định khi cuộn ngang */
.mt-dis-tablewrap--scroll .mt-dis-table th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--mt-bg-card, #FFFFFF);
  box-shadow: 1px 0 0 var(--mt-border, #C9D2DD);
}

.mt-dis-scrollhint {
  margin: -0.75rem 0 1rem;
}

@media (max-width: 40rem) {
  /* chế độ stack: mỗi hàng một khối, mỗi ô tự mang nhãn của cột (data-label) — một DOM duy nhất */
  .mt-table--stack,
  .mt-table--stack thead,
  .mt-table--stack tbody,
  .mt-table--stack tr,
  .mt-table--stack th,
  .mt-table--stack td,
  .mt-table--stack caption {
    display: block;
    width: auto;
  }

  .mt-table--stack {
    min-width: 0;
  }

  .mt-table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .mt-table--stack tr {
    padding: 0.5rem 0;
    border-bottom: 2px solid var(--mt-border, #C9D2DD);
  }

  .mt-table--stack th[scope="row"],
  .mt-table--stack th[scope="colgroup"] {
    padding: 0.5rem 0.9rem 0.25rem;
    border: 0;
    background: transparent;
    font-size: var(--mt-fs-base, 1rem);
  }

  .mt-table--stack td {
    padding: 0.25rem 0.9rem;
    border: 0;
    text-align: left;
  }

  .mt-table--stack td.mt-dis-num {
    text-align: left;
  }

  /* ô của cột chỉ-ở-hàng-tổng nằm ở hàng từng khối (luôn "—"): ẩn trong chế độ xếp chồng; trình đọc màn hình vẫn đọc được ở chế độ bảng */
  .mt-table--stack td.mt-dis-na {
    display: none;
  }

  .mt-table--stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--mt-text-muted, #576F8F);
    font-size: 0.8125rem;
    font-weight: 700;
  }

  .mt-table--stack tr:last-child td:last-child {
    border-bottom: 0;
  }

  .mt-table--stack tbody tr:hover,
  .mt-table--stack tbody tr:nth-child(even) {
    background: transparent;
  }

  .mt-dis-tablewrap--scroll .mt-dis-table th[scope="row"] {
    position: static;
    box-shadow: none;
  }

  .mt-dis-matrix {
    min-width: 0;
  }

  .mt-dis-row--sub th.mt-dis-item {
    padding-left: 1.5rem;
  }

  .mt-dis-toolbar {
    display: block;
  }
}

/* ---------- In ấn ---------- */
.mt-dis-printhead {
  display: none;
}

@media print {
  .mt-dis-printhead {
    display: block;
    margin: 0 0 1rem;
    padding: 0 0 0.5rem;
    border-bottom: 1px solid #000;
    font-size: 11pt;
  }

  .mt-dis-printhead__line {
    margin: 0;
  }

  .mt-dis-filter,
  .mt-dis-toolbar__actions,
  .mt-dis-campus-chips,
  .mt-dis__nav,
  .mt-dis__back,
  .mt-dis-footlinks,
  .mt-dis-older,
  .mt-dis-grid,
  .mt-dis-legend,
  .mt-dis-history,
  .mt-btn,
  .mt-file__actions,
  .mt-dis-scrollhint {
    display: none !important;
  }

  .mt-dis-section,
  .mt-dis-block,
  .mt-dis-status {
    break-inside: avoid;
  }

  .mt-dis-table tr,
  .mt-dis-matrix tr {
    break-inside: avoid;
  }

  .mt-dis-table {
    font-size: 8.5pt;
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  /* bảng nhiều cột phải gói vừa khổ giấy (không bị cắt mép): thu đệm, cho phép ngắt chữ dài */
  .mt-dis-table th,
  .mt-dis-table td {
    padding: 0.25rem 0.3rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .mt-dis-tablewrap--scroll .mt-dis-table th[scope="row"] {
    position: static;
    box-shadow: none;
  }

  .mt-dis-tablewrap {
    overflow: visible;
    border: 0;
  }

  .mt-dis-group {
    border: 0;
  }

  .mt-badge,
  .mt-dis-chip {
    border: 1px solid #000;
    background: #fff !important;
    color: #000 !important;
  }

  a[href]::after {
    content: "";
  }
}
