/* SITE — Báo cáo quản trị (theme kem + đỏ UEB, gần báo cáo Power BI) */
:root {
  --bg: #fcfbfa;
  --bg-elevated: #ffffff;
  --surface: #f4efea;
  --border: rgba(139, 21, 56, 0.12);
  --text: #231510;
  --text-muted: #6b5c57;
  --accent: #9A183C;
  --accent-bright: #B81D48;
  --accent-dim: rgba(154, 24, 60, 0.08);
  --chart-gold: #d49c11;
  --chart-terracotta: #a44834;
  --success: #287a52;
  --warning: #d19721;
  --font: "Inter", "Be Vietnam Pro", "Noto Sans", system-ui, -apple-system, sans-serif;
  --radius: 16px;
  --shadow: 0 16px 48px -12px rgba(43, 24, 18, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(180deg, #fffefc 0%, var(--bg) 45%, #f5efe6 100%);
  color: var(--text);
  line-height: 1.5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* —— Navbar —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 254, 252, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.logos {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.logos img {
  height: 44px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 2px 4px;
}

.logos img:first-child {
  max-height: 48px;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.brand-text .sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-controls label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.segment-select {
  appearance: none;
  color-scheme: light;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 2.25rem 0 0.85rem;
  height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c4d47' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.segment-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Custom program filter dropdown (replaces native <select>) */
.dt-select-wrap {
  position: relative;
  display: inline-block;
}

.dt-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 2.25rem 0 0.85rem;
  height: 44px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c4d47' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  transition: border-color 0.15s;
}

.dt-select-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dt-select-btn[aria-expanded="true"] {
  border-color: var(--accent);
}

.dt-select-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(43, 24, 18, 0.13);
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  z-index: 200;
}

.dt-select-list[hidden] { display: none; }

.dt-select-opt {
  padding: 0.45rem 0.85rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.1s;
}

.dt-select-opt:hover {
  background: var(--surface);
}

.dt-select-opt[aria-selected="true"] {
  color: var(--accent);
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 0.85rem;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

a.btn-ghost {
  text-decoration: none;
  display: inline-block;
}

.btn-ghost[hidden] {
  display: none !important;
}

/* Generic Dropdown Menu */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.site-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated, #ffffff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(43, 24, 18, 0.13);
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.dropdown-wrapper.is-open .site-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.site-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  border: none;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
  text-decoration: none;
}

.site-dropdown-item:hover {
  background: var(--surface);
  color: var(--accent);
}

.site-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0;
}

/* —— Main —— */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.view {
  display: none;
  animation: fadeIn 0.35s ease;
}

.view.is-active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.view-desc {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* —— Landing tiles —— */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  min-height: calc(100vh - 180px);
  align-items: stretch;
}

@media (max-width: 768px) {
  .tile-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

.tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, #ffffff 0%, #faf6f0 100%);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, var(--accent-dim), transparent 50%);
  pointer-events: none;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(139, 21, 56, 0.35);
  box-shadow: var(--shadow), 0 0 0 1px rgba(139, 21, 56, 0.12);
}

.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.tile-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 220px;
}

.tile-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: transparent;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.tile h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.tile p {
  margin: 0.65rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.tile-cta {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tile-cta span {
  transition: transform 0.2s ease;
}

.tile:hover .tile-cta span {
  transform: translateX(4px);
}

/* —— Dashboard layout —— */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
}

/* Tab 1000$: 6 KPI card — cố xếp trên 1 dòng (màn rộng); wrap thì chia ĐỀU: 6 → 3+3 → 2+2+2 */
#nh-kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#nh-kpi-grid .kpi-card { padding: 0.8rem 0.85rem; }
#nh-kpi-grid .kpi-card .value { font-size: 1.4rem; }
#nh-kpi-grid .kpi-card .hint { font-size: 0.72rem; }
@media (max-width: 1180px) { #nh-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px) { #nh-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpi-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.35rem;
}

.kpi-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.kpi-card .hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.embed-panel {
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.embed-panel strong {
  display: block;
  margin-bottom: 0.5rem;
}

.embed-panel p {
  margin: 0;
  color: var(--text-muted);
  max-width: 480px;
  font-size: 0.9rem;
}

/* —— Đào tạo: xem PDF —— */
.dao-pdf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

/* —— Đào tạo: dashboard native —— */
.dao-tao-dashboard {
  margin-top: 1.25rem; /* tách khỏi thanh nút thao tác phía trên */
}

.dao-tao-dashboard .dt-page-block,
.view-tuyen-sinh .ts-section {
  /* Panel mục nền TINT (giống .dao-tao-dashboard .dt-page-block) — tách mục rõ,
     card trắng bên trong nổi lên, không "hộp trong hộp". */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.dao-tao-dashboard .dt-page-block {
  /* Panel mục: nền TINT (khác nền trang + khác card trắng bên trong) để tách mục rõ,
     nhưng KHÔNG "hộp trong hộp" (panel tint vs card trắng — phân cấp rõ ràng). */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.15rem 1.25rem;
  margin-bottom: 1.75rem; /* gap lớn giữa các mục */
}

.view-tuyen-sinh .ts-section {
  padding: 1rem 1.15rem 1.25rem;
  margin-bottom: 1.75rem; /* gap lớn giữa các mục (như đào tạo) */
}
/* Khoảng cách DỌC giữa các card/lưới biểu đồ trong CÙNG mục.
   LƯU Ý: phần tử là #view-tuyen-sinh (ID) + class="view", KHÔNG có class "view-tuyen-sinh",
   nên phải dùng selector ID thì rule mới khớp (các rule .view-tuyen-sinh cũ đều CHẾT). */
#view-tuyen-sinh .ts-section > .chart-grid-2,
#view-tuyen-sinh .ts-section > .chart-wrap {
  margin-bottom: 1.4rem;
}
#view-tuyen-sinh .ts-section > .chart-grid-2:last-child,
#view-tuyen-sinh .ts-section > .chart-wrap:last-child {
  margin-bottom: 0;
}

/* Tiêu đề mục: banner maroon căn giữa, bo 12px — đồng bộ .ctsv-section-head / .tc-section-header */
.dao-tao-dashboard .dt-page-block h3,
.view-tuyen-sinh .ts-section > h3 {
  margin: 0 0 1rem;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dao-tao-dashboard .dt-page-note,
.view-tuyen-sinh .ts-note {
  margin-left: 0;
  margin-right: 0;
}

.dao-tao-dashboard .dt-page-filters {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated); /* nền trắng như .ctsv-filterbar */
}

.view-tuyen-sinh .ts-period-banner {
  box-shadow: 0 8px 24px rgba(43, 24, 18, 0.05);
}

.view-tuyen-sinh .tvts-subhead {
  display: block;
  margin: 0.2rem 0 0.65rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid rgba(139, 21, 56, 0.18);
  color: var(--accent);
}

/* Chart box đào tạo = card riêng: bo 12px, chiều cao gọn ~340px như .ctsv-chart-box */
.dao-tao-dashboard .dt-page-block .chart-wrap,
.dao-tao-dashboard .dt-charts-grid > .dt-table-wrap {
  border-radius: 12px;
}
.dao-tao-dashboard .chart-wrap {
  min-height: 340px;
}
/* Chart card tuyển sinh: bo 12px như đào tạo/CTSV/TC (giữ nguyên chiều cao đã tinh chỉnh) */
#view-tuyen-sinh .chart-wrap {
  border-radius: 12px;
  box-shadow: 0 2px 10px -5px rgba(43, 24, 18, 0.18); /* nổi nhẹ trên nền mục để tách card */
}

.dao-tao-dashboard .dt-page-block .chart-wrap,
.view-tuyen-sinh .chart-wrap,
.view-tuyen-sinh .tvts-table-scroll-wrap,
.view-tuyen-sinh .tvts-dialog,
.view-tuyen-sinh .data-table,
.view-tuyen-sinh .tvts-compare-table {
  border-color: var(--border);
}

.view-tuyen-sinh .tvts-dialog {
  box-shadow: 0 16px 48px rgba(43, 24, 18, 0.22);
}

.view-tuyen-sinh .tvts-dialog-panel {
  padding: 1rem 1.1rem 1.15rem;
}

.view-tuyen-sinh .tvts-dialog-head h3 {
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
}

.view-tuyen-sinh .tvts-dialog-close {
  background: var(--surface);
}

.view-tuyen-sinh .data-table thead th,
.view-tuyen-sinh .tvts-compare-table thead th {
  background: var(--surface);
}

.view-tuyen-sinh .data-table tr.row-total td,
.view-tuyen-sinh .data-table tr.row-total th {
  background: rgba(139, 21, 56, 0.1);
}

.dt-page-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 1rem 1.15rem 1.25rem;
  margin-bottom: 1.6rem;
}

.dt-page-block h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--accent);
}

.dt-page-note {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.dt-page-filters {
  margin-bottom: 1rem;
}

.dt-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.dt-charts-grid > * {
  min-width: 0;
}

.dt-charts-grid > *:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.dt-charts-grid.dt-charts-grid-1 {
  grid-template-columns: 1fr;
}

/* Tách các lưới biểu đồ liên tiếp trong CÙNG một mục (vd mảng 5: lưới điểm + lưới GPA)
   — trước đây chỉ có 1 lưới/mục nên không lộ; nay cần margin để card không dính sát nhau. */
.dao-tao-dashboard .dt-page-block .dt-charts-grid {
  margin-bottom: 1.25rem;
}
.dao-tao-dashboard .dt-page-block .dt-charts-grid:last-child {
  margin-bottom: 0;
}
.dao-tao-dashboard .dt-page-block .kpi-grid {
  margin-bottom: 1.25rem;
}

.dt-table-wrap {
  margin-bottom: 1rem;
}

/* Table cell inside chart grid: card-styled, fills row height */
.dt-charts-grid > .dt-table-wrap {
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: min(420px, 55vh);
  padding: 0.75rem 0.75rem 0.75rem;
}

.dt-charts-grid > .dt-table-wrap .tvts-table-scroll-wrap {
  flex: 1;
  max-height: unset;
  overflow-y: auto;
}

.dao-pdf-toolbar .dao-pdf-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dao-pdf-toolbar .dao-pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Tràn ngang viewport (khít chiều trang) */
.dao-pdf-fullbleed {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-bottom: 0.35rem;
}

.dao-pdf-fullbleed .dao-pdf-js-wrap {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.dao-pdf-viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.5rem 1.25rem;
  background: #fffefc;
}

.dao-pdf-page-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 14px rgba(43, 24, 18, 0.07);
}

.dao-pdf-loading,
.dao-pdf-error {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  margin: 0;
}

.dao-pdf-iframe-fallback {
  width: 100%;
  min-height: 75vh;
  border: 0;
  display: block;
  background: #fff;
}

.dao-pdf-iframe-fallback[hidden] {
  display: none !important;
}

.dao-pdf-fallback {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--surface);
}

.dao-pdf-fallback a {
  font-weight: 600;
}

.table-placeholder {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.table-placeholder th,
.table-placeholder td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
}

.table-placeholder th {
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-placeholder tbody tr:nth-child(even) {
  background: rgba(139, 21, 56, 0.04);
}

/* —— Tuyển sinh: ngữ cảnh kỳ báo cáo —— */
.ts-period-banner {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(139, 21, 56, 0.22);
  background: rgba(139, 21, 56, 0.06);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* —— Đào tạo: hàng lọc biểu đồ —— */
.dt-filter-row {
  margin-top: -0.25rem;
}

.view-title-home {
  margin-bottom: 1rem;
}

.ts-period-banner strong {
  color: var(--text);
  font-weight: 600;
}

.ts-100do-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.ts-100do-toolbar label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.ts-100do-toolbar .segment-select {
  min-width: min(100%, 280px);
}

/* —— Tuyển sinh: bảng dữ liệu —— */
.ts-section {
  margin-bottom: 2.25rem;
}

.ts-section h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.ts-section .ts-note {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tvts-subhead {
  margin: 0.5rem 0 0.4rem;
  padding: 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.dt-charts-grid > .dt-table-wrap > .tvts-subhead {
  margin-top: 0;
}

.tvts-note-small {
  font-size: 0.8rem;
  margin-top: -0.15rem;
}

.tvts-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.tvts-compare-table th,
.tvts-compare-table td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  text-align: left;
}

.tvts-compare-table thead th {
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tvts-compare-table tbody tr:nth-child(even) {
  background: rgba(139, 21, 56, 0.04);
}

.tvts-compare-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-search-input {
  display: block;
  width: 100%;
  max-width: 320px;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  margin-bottom: 0.4rem;
}

.table-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(139, 21, 56, 0.15);
}

.tvts-table-scroll-wrap {
  max-height: min(480px, 55vh);
  overflow: auto;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.tvts-dialog-table-wrap {
  max-height: min(48vh, 520px);
  margin-top: 0.75rem;
}

.tvts-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(960px, 96vw);
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(43, 24, 18, 0.22);
}

.tvts-dialog.dialog-md {
  max-width: min(600px, 96vw);
}

.tvts-dialog.dialog-lg {
  max-width: min(960px, 96vw);
}

.tvts-dialog::backdrop {
  background: rgba(43, 24, 18, 0.45);
}

.tvts-dialog-panel {
  padding: 1rem 1.15rem 1.2rem;
  max-height: min(92vh, 880px);
  overflow: auto;
}

.tvts-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.tvts-dialog-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.tvts-dialog-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.tvts-dialog-close:hover {
  color: var(--accent);
  border-color: rgba(139, 21, 56, 0.35);
}

.tvts-dialog-chart {
  height: min(360px, 38vh);
  min-height: 240px;
  margin-bottom: 0.25rem;
}

.tvts-link-btn {
  margin-left: 0.35rem;
  vertical-align: baseline;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  vertical-align: middle;
}

.data-table thead th {
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.data-table thead th.sortable {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.data-table thead th.sortable::after {
  content: " ⇅";
  opacity: 0.35;
  font-size: 0.85em;
}

.data-table thead th.sortable[data-sort="asc"]::after {
  content: " ↑";
  opacity: 1;
  color: var(--accent);
}

.data-table thead th.sortable[data-sort="desc"]::after {
  content: " ↓";
  opacity: 1;
  color: var(--accent);
}

.data-table thead th.sortable:hover {
  background: var(--surface-hover, rgba(139, 21, 56, 0.08));
  color: var(--text);
}

.data-table tbody th {
  font-weight: 600;
  text-align: left;
  background: rgba(242, 235, 226, 0.95);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr:nth-child(even):not(.row-total) {
  background: rgba(139, 21, 56, 0.04);
}

.data-table tr.row-total td,
.data-table tr.row-total th {
  background: rgba(139, 21, 56, 0.1);
  font-weight: 700;
  border-top-width: 2px;
}

.data-table .cell-empty {
  color: var(--text-muted);
}

.chart-plan {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 0;
  overflow: hidden;
}

.chart-plan summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.chart-plan summary::-webkit-details-marker {
  display: none;
}

.chart-plan summary::after {
  content: " ▼";
  font-size: 0.7rem;
  color: var(--text-muted);
}

.chart-plan[open] summary::after {
  content: " ▲";
}

.chart-plan .plan-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.chart-plan .plan-body ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.chart-plan .plan-body li {
  margin-bottom: 0.45rem;
}

.chart-plan .plan-body strong {
  color: var(--text);
}

/* —— ECharts containers —— */
.chart-wrap {
  width: 100%;
  min-height: min(420px, 55vh);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-sizing: border-box;
}

.chart-wrap.chart-wrap-tall {
  min-height: min(480px, 62vh);
}

.chart-wrap.chart-wrap-compact {
  height: min(288px, 36vh);
  min-height: 240px;
  margin-bottom: 0.75rem;
}

.chart-wrap.chart-wrap-extra-tall {
  height: min(560px, 70vh);
  min-height: 400px;
}

.chart-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  align-items: stretch;
}

.chart-grid-2 > * {
  min-width: 0;
}

/* Lưới 2 cột lệch 2:1 — dùng khi biểu đồ trái cần nhiều chỗ hơn hẳn
   (VD "Theo chuyên ngành" nhiều dòng, cạnh donut IELTS nhỏ gọn). */
.chart-grid-21 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.4rem;
  align-items: stretch;
}
.chart-grid-21 > * { min-width: 0; }
@media (max-width: 900px) {
  .chart-grid-21 { grid-template-columns: 1fr; }
}

.chart-grid-2 > .dt-table-wrap {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .chart-grid-2,
  .dt-charts-grid {
    grid-template-columns: 1fr;
  }
  .dt-charts-grid > *:last-child:nth-child(odd) {
    grid-column: unset;
  }
  .dt-charts-grid > .dt-table-wrap {
    min-height: 320px;
  }
  .chart-wrap {
    min-height: 360px;
  }
  .chart-wrap.chart-wrap-tall {
    min-height: min(420px, 58vh);
  }
  .chart-wrap.chart-wrap-compact {
    min-height: 260px;
  }
  .chart-wrap.chart-wrap-extra-tall {
    min-height: min(480px, 62vh);
  }
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent-bright);
  font-weight: 600;
}

.view-desc code {
  font-size: 0.85em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* —— Báo cáo Tài chính —— */
.tai-chinh-dashboard {
  margin-top: 0.5rem;
}

.tc-loading,
.tc-error {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
}

.tc-dashboard {
  display: grid;
  grid-template-columns: minmax(160px, 200px) 1fr;
  gap: 1rem;
  align-items: start;
}

.tc-filters {
  background: var(--accent);
  border-radius: var(--radius);
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 0.5rem;
}

.tc-filters-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.tc-filter-block {
  background: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

.tc-filter-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #5c4d47;
  margin-bottom: 0.35rem;
}

.tc-filter-select {
  width: 100%;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.tc-filter-block[hidden] {
  display: none;
}

.tc-filter-note {
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(91, 44, 131, 0.08);
  border-radius: 6px;
  border-left: 3px solid #5b2c83;
}

.tc-main {
  min-width: 0;
}

.tc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tc-tab {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

.tc-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Đồng bộ với CTSV: các khối trắng xếp dọc, cách đều gap 1rem (bỏ panel bọc tím) */
.tc-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: transparent;
  padding: 0;
}

/* JS ẩn panel không active bằng thuộc tính [hidden]; display:flex ở trên đè
   lên [hidden]{display:none} mặc định nên phải ẩn lại tường minh */
.tc-tab-panel[hidden] {
  display: none;
}

.tc-section-header {
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  margin-bottom: 0; /* khoảng cách do gap của .tc-tab-panel lo */
}

.tc-metrics-wrap {
  margin-bottom: 0;
}

.tc-metrics {
  display: grid;
  gap: 0.75rem; /* khớp .ctsv-kpi-row */
}

.tc-metrics-1 {
  grid-template-columns: 1fr;
}

.tc-metrics-2 {
  grid-template-columns: repeat(2, 1fr);
}

.tc-metrics-3 {
  grid-template-columns: repeat(3, 1fr);
}

.tc-metrics-4 {
  grid-template-columns: repeat(4, 1fr);
}

.tc-metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  text-align: center;
}

.tc-metric-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.tc-metric-value {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

/* Gợi ý thẻ KPI bấm được (drill-down) */
.tc-metric-drill-hint {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
}

.tc-chart-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 0; /* khoảng cách do gap của .tc-tab-panel lo */
}

.tc-chart-row-1 {
  grid-template-columns: 1fr;
}

.tc-chart-row-2 {
  grid-template-columns: repeat(2, 1fr);
}

.tc-chart-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.tc-chart-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  min-width: 0;
}

.tc-chi-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1rem;
  align-items: stretch;
}

.tc-chi-left {
  min-width: 0; /* tôn trọng đúng bề rộng cột grid, không cho bảng tràn ra */
}

.tc-chi-left .tc-metrics-wrap {
  margin-bottom: 1rem;
}

.tc-chi-right {
  min-width: 0;
}

.tc-table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  height: 360px;       /* khớp đúng chiều cao với 2 biểu đồ tròn bên cạnh */
}

.tc-table-title {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.tc-table-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0; /* cho phép cuộn trong flex column */
}

.tc-detail-table {
  width: 100%;
  font-size: 0.78rem;
}

.tc-detail-table th,
.tc-detail-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tc-detail-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  position: sticky;
  bottom: 0;
  background: #fff; /* che dòng cuộn phía sau, neo Total ở đáy */
}

.tc-num {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .tc-dashboard {
    grid-template-columns: 1fr;
  }

  .tc-filters {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tc-filter-block {
    flex: 1 1 140px;
  }

  .tc-chart-row-3 {
    grid-template-columns: 1fr;
  }

  .tc-chi-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .tc-metrics-2,
  .tc-metrics-3,
  .tc-metrics-4 {
    grid-template-columns: 1fr;
  }

  .tc-chart-row-2 {
    grid-template-columns: 1fr;
  }
}

/* —— User Profile Styles —— */
.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.65rem 0 0.45rem;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  box-sizing: border-box;
}

.user-profile-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(139, 21, 56, 0.08);
  text-decoration: none;
}

.user-profile-btn[hidden] {
  display: none !important;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Profile Page */
.profile-main {
  max-width: 600px;
}

.profile-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 1.5rem;
}

.profile-card-header {
  padding: 2rem 1.75rem;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.9) 0%, rgba(139, 21, 56, 0.03) 100%);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.75rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(139, 21, 56, 0.15);
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-header-text h3 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.role-badge {
  display: inline-block;
  margin: 0;
  padding: 0.25rem 0.65rem;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.profile-card-body {
  padding: 1.5rem 1.75rem;
}

.info-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
}

.info-group:last-child {
  margin-bottom: 0;
}

.info-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.info-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.text-monospace {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
}

/* ============================================================
   CÔNG TÁC SINH VIÊN (ctsv)
   ============================================================ */
.ctsv-shell { display: flex; flex-direction: column; gap: 1rem; }

.ctsv-tabs {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  border-bottom: 1px solid var(--border, var(--border)); padding-bottom: 0.5rem;
}
.ctsv-tab {
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  padding: 0.4rem 0.85rem; border-radius: 999px; cursor: pointer;
  font-size: 0.82rem; font-weight: 600;
}
.ctsv-tab:hover { border-color: rgba(139,21,56,0.35); }
.ctsv-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.ctsv-panel { display: flex; flex-direction: column; gap: 1rem; }

/* Tuyển sinh — 3 tab panel */
#ts-tabs { margin-top: 0.25rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.ts-datamode-toggle {
  margin-left: auto; font-size: 0.76rem; font-weight: 600; white-space: nowrap;
  padding: 0.3rem 0.75rem; border-radius: 999px; cursor: pointer;
  border: 1px solid #9fcdb0; background: #eef8f1; color: #2e7d52;
}
.ts-datamode-toggle.is-static { border-color: #f0c36d; background: #fff7e6; color: #b06a12; }
.ts-datamode-toggle:hover { filter: brightness(0.97); }
.dt-datamode-bar { display: flex; justify-content: flex-end; margin: 0 0 0.6rem; }
.ts-tabpanel { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1rem; }
.ts-tabpanel[hidden] { display: none; }
.kpi-sub { font-size: 0.62em; font-weight: 600; color: var(--text-muted); }

/* Thứ tự cố định: Tiêu đề → Bộ lọc → Chỉ số tổng quan → các khối còn lại */
/* Tiêu đề mục: banner maroon căn giữa, bo tròn — đồng bộ với .tc-section-header */
.ctsv-hb-note {
  margin: 0.5rem 0 0.25rem;
  padding: 0.55rem 0.8rem;
  background: #fff7e6;
  border: 1px solid #f0c36d;
  border-left: 4px solid #d99a1c;
  border-radius: 8px;
  color: #8a5a00;
  font-size: 0.86rem;
  line-height: 1.4;
}
.ctsv-section-head {
  order: -3; /* luôn trên cùng */
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  padding: 0.65rem 1rem;
  border-radius: 12px;
}
.ctsv-filterbar { order: -2; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ctsv-filter-note { font-size: 0.78rem; color: var(--text-muted); }
.ctsv-kpi-wrap { order: -1; }
/* Caption từng biểu đồ/bảng: chữ nhỏ (KHÔNG banner) */
.ctsv-block-title { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
/* Nhãn phụ giữ chữ nhỏ (vd "Bộ lọc") */
.ctsv-mini-title { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
/* Header NHÓM biểu đồ/bảng (section) — banner maroon, đồng bộ .ctsv-section-head */
.ctsv-group-head {
  display: block;
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  margin-bottom: 0.7rem;
}

.ctsv-filterbar,
.ctsv-kpi-wrap,
.ctsv-chart-wrap {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 1rem;
}

.ctsv-filter-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.ctsv-filter { display: flex; flex-direction: column; gap: 0.25rem; min-width: 160px; }
.ctsv-filter-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.ctsv-select {
  padding: 0.45rem 0.55rem; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 0.85rem; background: #fff; color: var(--text);
}

/* KPI */
/* KPI xếp CHUNG 1 HÀNG — mỗi thẻ chia đều chiều rộng, co lại thay vì xuống dòng */
.ctsv-kpi-row { display: flex; flex-wrap: nowrap; gap: 0.75rem; align-items: stretch; }
.ctsv-kpi-main {
  display: flex; align-items: center; gap: 0.75rem;
  background: linear-gradient(135deg, var(--accent-dim), #fdfaf7);
  border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 1.1rem; flex: 1 1 0; min-width: 0;
}
.ctsv-kpi-icon {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--accent); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.ctsv-kpi-big { font-size: 2.2rem; font-weight: 800; color: var(--accent); line-height: 1; }
.ctsv-kpi-caption { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.ctsv-kpi-card {
  display: flex; flex-direction: column; justify-content: center; gap: 0.25rem;
  border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 1rem; flex: 1 1 0; min-width: 0;
}
/* Màn hẹp: cho phép KPI xuống dòng để không vỡ layout */
@media (max-width: 1024px) {
  .ctsv-kpi-row { flex-wrap: wrap; }
  .ctsv-kpi-card, .ctsv-kpi-main { flex: 1 1 150px; }
}
.ctsv-kpi-num { font-size: 1.6rem; font-weight: 800; color: var(--text); }

/* ===== Mảng Phòng dự án (du-an) ===== */
.da-kpi-cov { color: #b06a12; font-size: 0.72rem; font-weight: 600; }
/* Bảng "Báo cáo thu": cột Nội dung xuống dòng, cố định layout → không cuộn ngang */
.ctsv-table.da-thu-table { table-layout: fixed; width: 100%; }
.ctsv-table.da-thu-table th, .ctsv-table.da-thu-table td { white-space: normal; word-break: break-word; overflow-wrap: anywhere; vertical-align: top; }
.da-small-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.2rem 0 0.4rem; }
.da-small-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.45rem 0.75rem; font-size: 0.85rem; background: var(--bg-elevated); }
.da-small-card .da-cov { color: var(--text-muted); font-size: 0.75rem; }
.da-toggle, .da-reset { padding: 0.3rem 0.7rem; font-size: 0.78rem; border-radius: 8px; }
.da-reset { align-self: center; }
.da-active-filter { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--accent-dim); border: 1px solid rgba(139,21,56,0.25); color: var(--accent); border-radius: 999px; padding: 0.25rem 0.6rem; font-size: 0.82rem; width: fit-content; }
.da-chip-x { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.9rem; line-height: 1; }
.da-badge { display: inline-block; color: #fff; font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.da-row { cursor: pointer; }
.da-row:hover td { background: var(--surface); }
.ctsv-table td.da-wrap { white-space: normal; min-width: 160px; max-width: 320px; }
/* Bộ lọc mảng Phòng dự án — nén để nằm trên 1 dòng (tràn thì cuộn ngang) */
#view-du-an .ctsv-filterbar { flex-wrap: nowrap; gap: 0.45rem; align-items: flex-end; overflow-x: auto; }
#view-du-an .ctsv-filter { gap: 0.12rem; min-width: 0; }
#view-du-an .ctsv-filter-label { font-size: 0.66rem; white-space: nowrap; }
#view-du-an .ctsv-filterbar .ctsv-select { padding: 0.28rem 0.4rem; font-size: 0.78rem; min-width: 0; max-width: 150px; }
#view-du-an .da-reset { padding: 0.3rem 0.6rem; font-size: 0.74rem; white-space: nowrap; flex: 0 0 auto; }

/* Nút Quay lại — vuông gọn, cạnh tiêu đề trong header drill */
.da-back-btn { flex: 0 0 auto; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; line-height: 1; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--accent); cursor: pointer; }
.da-back-btn:hover { border-color: var(--accent); background: var(--accent-dim); }
/* Màn Tiến độ & rủi ro — danh sách thẻ bằng nhau */
.da-risk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; grid-auto-rows: 1fr; margin-top: 0.75rem; }
.da-risk-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elevated); padding: 0.85rem 1rem; cursor: pointer; }
.da-risk-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px -6px rgba(154,24,60,0.3); }
.da-risk-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.3rem; }
.da-risk-ma { font-weight: 800; color: var(--accent); font-size: 0.9rem; }
.da-risk-name { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.2rem; }
.da-risk-sub { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem; }
/* Tiến độ & rủi ro: thống kê cơ bản + danh sách theo dòng */
.da-risk-stats { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0.7rem 0 1rem; }
.da-rs { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elevated); padding: 0.5rem 0.85rem; min-width: 5.4rem; }
.da-rs-v { display: block; font-size: 1.3rem; font-weight: 800; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.da-rs-l { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }
.da-risk-table tbody tr { cursor: pointer; }
.da-risk-table tbody tr:hover { background: rgba(154, 24, 60, 0.06); }
.da-rf { margin-bottom: 0.4rem; }
.da-rf-l { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text-muted); font-weight: 700; }
.da-rf-v { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.85rem; color: var(--text); }
.da-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1.25rem; margin-bottom: 0.75rem; }
.da-field { margin-bottom: 0.55rem; }
.da-flabel { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text-muted); font-weight: 700; margin-bottom: 0.1rem; }
.da-fval { font-size: 0.9rem; color: var(--text); white-space: pre-wrap; }
@media (max-width: 720px) { .da-detail-grid { grid-template-columns: 1fr; } }
.ctsv-kpi-sub { font-size: 0.78rem; color: var(--text-muted); }
/* Badge so sánh gắn ngay trong thẻ KPI */
.ctsv-kpi-delta { margin-top: 0.35rem; font-size: 0.75rem; font-weight: 700; line-height: 1.3; }
.ctsv-kpi-delta.up { color: #15803d; }
.ctsv-kpi-delta.down { color: #b45309; }
.ctsv-kpi-delta.muted { color: #94a3b8; font-weight: 500; }
.ctsv-kpi-tag {
  align-self: flex-start; background: var(--accent-dim); color: var(--accent); font-weight: 700;
  padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.95rem;
}
.ctsv-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.65rem; }
.ctsv-chip {
  font-size: 0.78rem; color: var(--text); background: var(--surface);
  padding: 0.25rem 0.6rem; border-radius: 999px;
}
.ctsv-chip-amber { background: #fef3c7; color: #92400e; }

/* Biểu đồ + nhận xét */
.ctsv-chart-layout {
  display: grid; grid-template-columns: 1fr minmax(200px, 260px); gap: 1rem; align-items: stretch;
}
.ctsv-chart-box { min-height: 340px; }
.ctsv-comment {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 1rem;
  display: flex; flex-direction: column; gap: 0.5rem; align-self: start;
}
.ctsv-comment-head { font-weight: 700; color: var(--accent); font-size: 0.9rem; }
.ctsv-comment-body { font-size: 0.9rem; color: var(--text); line-height: 1.5; }

.ctsv-placeholder {
  text-align: center; color: #94a3b8; padding: 3rem 1rem;
  border: 2px dashed var(--border); border-radius: 12px;
}
.ctsv-placeholder-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.ctsv-placeholder-sub { font-size: 0.85rem; margin-top: 0.35rem; }

@media (max-width: 900px) {
  .ctsv-chart-layout { grid-template-columns: 1fr; }
}

.ctsv-note { margin-top: 0.6rem; font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.ctsv-chart-grid1 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.ctsv-chart-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ctsv-empty {
  display: flex; align-items: center; justify-content: center; min-height: 300px;
  color: #94a3b8; font-size: 0.9rem;
}
@media (max-width: 900px) { .ctsv-chart-grid2 { grid-template-columns: 1fr; } }

/* Bố cục sự kiện:  [1][2] / [3][2]  — biểu đồ 2 chiếm nguyên cột phải, cao gấp đôi */
.ctsv-sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: stretch; }
.ctsv-sk-col { display: flex; flex-direction: column; gap: 1rem; }
.ctsv-sk-grid > .ctsv-card { display: flex; flex-direction: column; }
.ctsv-sk-grid > .ctsv-card .ctsv-chart-box { flex: 1 1 auto; }
@media (max-width: 900px) { .ctsv-sk-grid { grid-template-columns: 1fr; } }

/* Phễu vận động tài trợ: [nhãn bước] [phễu] [tỷ lệ chuyển đổi] */
.ctsv-funnel { display: grid; grid-template-columns: minmax(120px, auto) 1fr minmax(120px, auto); gap: 0.75rem; align-items: stretch; }
.ctsv-funnel .ctsv-chart-box { min-height: 300px; }
.ctsv-funnel-labels, .ctsv-funnel-conv { display: flex; flex-direction: column; justify-content: space-around; gap: 0.5rem; padding: 1.2rem 0; }
.ctsv-funnel-step { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text); }
.ctsv-funnel-num {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 999px;
  background: transparent; border: 2px solid var(--accent); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700;
}
.ctsv-funnel-conv { text-align: right; }
.ctsv-funnel-conv-item { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.95rem; font-weight: 700; color: var(--text); min-height: 1px; }
.ctsv-funnel-conv-lbl { font-size: 0.72rem; font-weight: 400; color: var(--text-muted); }
.ctsv-funnel-total {
  margin-top: 0.75rem; text-align: center; padding: 0.5rem 1rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); font-size: 0.9rem; color: var(--text);
}
.ctsv-funnel-total strong { color: var(--accent); }
@media (max-width: 720px) {
  .ctsv-funnel { grid-template-columns: 1fr; }
  .ctsv-funnel-labels, .ctsv-funnel-conv { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; padding: 0; }
  .ctsv-funnel-conv { text-align: left; }
}

.ctsv-chip-green { background: #dcfce7; color: #15803d; }

/* Thẻ khối (card) dùng cho các mục có nhiều biểu đồ + bảng */
.ctsv-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.1rem;
}
.ctsv-card .ctsv-chart-box { min-height: 300px; }
.ctsv-card > .ctsv-block-title { margin-bottom: 0.4rem; }
/* Card có control lọc Kỳ ngay trong header */
.ctsv-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.ctsv-card-head > .ctsv-block-title { margin-bottom: 0; }
.ctsv-card-monthfilter { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--text-muted); }
.ctsv-card-monthfilter .ctsv-select { padding: 0.2rem 0.45rem; font-size: 0.78rem; }

/* Bảng dữ liệu */
.ctsv-table-scroll { overflow-x: auto; }
.ctsv-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.ctsv-table th, .ctsv-table td {
  padding: 0.55rem 0.7rem; text-align: left; border-bottom: 1px solid #eef1f6; white-space: nowrap;
}
.ctsv-table th { background: var(--surface); color: var(--text-muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
.ctsv-table td.num, .ctsv-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ctsv-table tbody tr:hover { background: var(--surface); }
.ctsv-table tr.total td { font-weight: 700; background: var(--surface); border-top: 2px solid var(--border); }
.ctsv-table td.wrap { white-space: normal; min-width: 220px; }
/* Tiêu đề cột bấm để sắp xếp (bảng drill) — cùng ký hiệu với .data-table */
.ctsv-table th.sortable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.ctsv-table th.sortable::after { content: " ⇅"; opacity: 0.35; font-size: 0.85em; }
.ctsv-table th.sortable[data-sort="asc"]::after { content: " ↑"; opacity: 1; color: var(--accent); }
.ctsv-table th.sortable[data-sort="desc"]::after { content: " ↓"; opacity: 1; color: var(--accent); }
.ctsv-table th.sortable:hover { color: var(--text); }
.ctsv-table th.sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ctsv-table td.stt, .ctsv-table th.stt { width: 1%; text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Nhãn trạng thái */
.ctsv-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.ctsv-badge-ok { background: #dcfce7; color: #15803d; }
.ctsv-badge-wait { background: #fef3c7; color: #b45309; }
.ctsv-badge-run { background: #dbeafe; color: #1d4ed8; }
.ctsv-badge-cancel { background: #fee2e2; color: #b91c1c; }

/* CTSV — thanh trên: chọn năm dữ liệu + upload Excel + trạng thái */
.ctsv-topbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; margin-bottom: 0.25rem; }

/* Import/cấu hình thu gọn thành icon ⚙ cạnh tiêu đề trang */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.view-head .view-title { margin: 0; }
.ctsv-topbar-collapse { position: relative; display: inline-flex; width: auto; flex: 0 0 auto; margin: 0; }
.ctsv-shell > .ctsv-topbar-collapse { align-self: flex-end; } /* CTSV/nhân sự: gear ở góc phải trên */
.ctsv-gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: #fff; border: 1px solid var(--border); color: var(--text);
  font-size: 1.05rem; line-height: 1; transition: background .15s, border-color .15s, color .15s;
}
.ctsv-gear:hover { background: var(--bg-subtle, #f6f1ee); border-color: var(--accent, #9A183C); }
.ctsv-gear.is-open { background: var(--accent, #9A183C); color: #fff; border-color: var(--accent, #9A183C); }
.ctsv-gear-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 0.8rem 0.9rem; box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.7rem;
  min-width: 260px; max-width: min(90vw, 460px);
}
.ctsv-gear-panel[hidden] { display: none; }

/* ===== Quản lý tài khoản (admin) + modal đổi mật khẩu ===== */
.acc-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.acc-btn { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.acc-btn:hover { background: var(--bg-subtle, #f6f1ee); }
.acc-btn.primary { background: var(--accent, #9A183C); color: #fff; border-color: var(--accent, #9A183C); }
.acc-btn.primary:hover { filter: brightness(1.06); }
.acc-btn.danger { background: #b3261e; color: #fff; border-color: #b3261e; }
.acc-btn:disabled { opacity: .6; cursor: default; }
.acc-status { font-size: 0.82rem; color: var(--text-muted); }
.acc-status.warn { color: #b3261e; }
.acc-status.ok { color: #287a52; }
.acc-actions { white-space: nowrap; text-align: right; }
.acc-link { background: none; border: none; color: var(--accent, #9A183C); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; padding: 0 0.4rem; }
.acc-link:hover { text-decoration: underline; }
/* Nút thao tác dạng icon */
.acc-iconbtn { background: none; border: 1px solid transparent; border-radius: 7px; cursor: pointer; line-height: 0; padding: 0.32rem; color: var(--text-muted, #6b5750); }
.acc-iconbtn svg { display: block; }
.acc-iconbtn:hover { background: var(--bg-subtle, #f4eeea); border-color: var(--border, #e3d3cf); color: var(--accent, #9A183C); }
.acc-iconbtn.danger:hover { background: #fdecec; border-color: #e6b0b0; color: #b3261e; }
/* Toolbar: tìm kiếm + lọc */
.acc-search { min-width: 220px; flex: 1 1 220px; max-width: 340px; }
.acc-filter { min-width: 170px; }
.acc-count { font-size: 0.8rem; color: var(--text-muted, #6b5750); margin: 0.2rem 0 0.5rem; }
/* Bảng: KHÔNG tràn trang, chữ dài → ellipsis */
.acc-usertable { table-layout: fixed; width: 100%; }
.acc-usertable th, .acc-usertable td { overflow: hidden; }
.acc-usertable td.ell { text-overflow: ellipsis; white-space: nowrap; max-width: 0; }
.acc-usertable th:nth-child(1), .acc-usertable td:nth-child(1) { width: 17%; }
.acc-usertable th:nth-child(2), .acc-usertable td:nth-child(2) { width: 20%; }
.acc-usertable th:nth-child(3), .acc-usertable td:nth-child(3) { width: 27%; }
.acc-usertable th:nth-child(4), .acc-usertable td:nth-child(4) { width: 16%; }
.acc-usertable th:nth-child(5), .acc-usertable td:nth-child(5) { width: 9%; }
.acc-usertable th:nth-child(6), .acc-usertable td:nth-child(6) { width: 11%; }
.acc-link.danger { color: #b3261e; }
.acc-chip { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--bg-subtle, #f1e9e6); font-size: 0.75rem; }
.acc-chip.admin { background: var(--accent, #9A183C); color: #fff; }
.acc-muted { color: var(--text-muted); }

.acc-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(35, 21, 16, .45); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.acc-modal { background: #fff; border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 460px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 64px -20px rgba(43, 24, 18, .4); }
.acc-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); }
.acc-modal-title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--accent, #9A183C); }
.acc-modal-close { background: none; border: 1px solid var(--border); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; }
.acc-modal-body { padding: 1rem 1.1rem; overflow: auto; display: flex; flex-direction: column; gap: 0.75rem; }
.acc-modal-foot { padding: 0.85rem 1.1rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.6rem; }
.acc-field { display: flex; flex-direction: column; gap: 0.3rem; }
.acc-field-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.acc-input { padding: 0.5rem 0.65rem; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; font-size: 0.88rem; width: 100%; }
.acc-input:disabled { background: #f3f0ee; color: var(--text-muted); }
.acc-pw { position: relative; }
.acc-pw .acc-input { padding-right: 3.4rem; }
.acc-pw-toggle { position: absolute; top: 0; right: 0; height: 100%; border: none; background: none; color: var(--accent, #9A183C); font-weight: 600; font-size: 0.8rem; padding: 0 0.7rem; cursor: pointer; }
.acc-segs { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.acc-seg { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; }
.acc-confirm { margin: 0; font-size: 0.9rem; }
.ctsv-upload-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  background: var(--accent, #9A183C); color: #fff; font-weight: 600; font-size: 0.85rem;
  padding: 0.5rem 0.9rem; border-radius: 8px; align-self: flex-end;
}
.ctsv-upload-btn:hover { filter: brightness(1.06); }
.ctsv-status { font-size: 0.8rem; color: var(--text-muted, #5c4d47); align-self: center; }
.ctsv-status.ok { color: #15803d; }
.ctsv-status.warn { color: #b45309; }
.ctsv-lastupd { font-size: 0.78rem; color: var(--text-muted, #5c4d47); margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px dashed rgba(43,24,18,0.14); font-variant-numeric: tabular-nums; }

/* Nút tải template (viền màu chủ đạo, rỗng) */
.ctsv-tpl-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; align-self: flex-end;
  border: 1.5px solid var(--accent, #9A183C); color: var(--accent, #9A183C);
  background: transparent; font-weight: 600; font-size: 0.85rem;
  padding: 0.45rem 0.85rem; border-radius: 8px; text-decoration: none; cursor: pointer;
}
.ctsv-danger-btn { border-color: #e0a0a0 !important; color: #b91c1c !important; }
.ctsv-danger-btn:hover { background: #fef2f2; }
.ctsv-tpl-btn:hover { background: var(--accent-dim, rgba(154,24,60,0.08)); text-decoration: none; }

/* Nút "Khôi phục" trong bảng lịch sử — gọn hơn nút trong panel */
.ctsv-table .ctsv-tpl-btn {
  align-self: auto; padding: 0.25rem 0.6rem; font-size: 0.78rem; white-space: nowrap;
}
/* Nút không dùng được: LÀM MỜ tại chỗ, không ẩn — người dùng vẫn thấy chức năng tồn tại
   và tooltip cho biết vì sao chưa bấm được (chưa đăng nhập / không đủ quyền / đang xử lý). */
.ctsv-tpl-btn.is-disabled,
.ctsv-upload-btn.is-disabled,
.ctsv-tpl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: auto; /* vẫn nhận hover để hiện tooltip lý do */
}
.ctsv-tpl-btn.is-disabled:hover,
.ctsv-upload-btn.is-disabled:hover,
.ctsv-tpl-btn:disabled:hover { background: transparent; }
/* Nút upload là <label> bọc <input>: setDisabled() khoá chính thẻ input nên bấm nhãn
   không mở được hộp chọn file — vẫn giữ hover để hiện tooltip lý do. */

/* —— Drill-down: thẻ/biểu đồ bấm được + modal danh sách chi tiết —— */
.ctsv-clickable { cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s; }
.ctsv-clickable:hover { border-color: var(--accent); box-shadow: 0 4px 14px -6px rgba(154, 24, 60, 0.35); }
.ctsv-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ctsv-drill-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(35, 21, 16, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.ctsv-drill-overlay[hidden] { display: none; }
.ctsv-drill {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  /* Kích cỡ CỐ ĐỊNH — không co theo số dòng (list 1–2 dòng vẫn giữ khung lớn) */
  width: 100%; max-width: 1040px; height: 82vh; max-height: 860px; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px -20px rgba(43, 24, 18, 0.4);
}
/* Thanh công cụ drill danh sách SV: ô tìm + các bộ lọc */
.ctsv-drill-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; margin-bottom: 0.75rem; }
.ctsv-drill-searchwrap { flex: 1 1 220px; display: flex; }
.ctsv-drill-search {
  width: 100%; padding: 0.5rem 0.65rem; border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; font-size: 0.85rem; background: #fff; color: var(--text);
}
.ctsv-drill-search:focus { outline: 2px solid var(--accent-dim); outline-offset: 1px; border-color: var(--accent); }
.ctsv-drill-filter { min-width: 150px; }
.dt-drill-filter {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid #d1d5db; border-radius: 8px;
  font: inherit; font-size: 0.85rem; background: #fff; color: var(--text); cursor: pointer;
}
.dt-drill-filter:focus { outline: 2px solid var(--accent-dim); outline-offset: 1px; border-color: var(--accent); }
.ctsv-drill-toolbar .ctsv-drill-searchwrap:has(.dt-drill-filter) { flex: 0 1 190px; }
.ctsv-drill-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border);
}
.ctsv-drill-title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--accent); }
.ctsv-drill-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }
.ctsv-drill-close {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 0.9rem; line-height: 1;
}
.ctsv-drill-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Body = cột dọc, KHÔNG tự cuộn; vùng bảng bên trong mới cuộn → toolbar + đầu bảng anchor. */
.ctsv-drill-body { padding: 0.6rem 1.1rem 1rem; display: flex; flex-direction: column; overflow: hidden; }
.ctsv-drill-body > .ctsv-drill-toolbar { flex: 0 0 auto; margin-bottom: 0.6rem; }
.ctsv-drill-body > .ctsv-drill-tablehost,
.ctsv-drill-body > .ctsv-table-scroll { flex: 1 1 auto; overflow: auto; min-height: 0; }
.ctsv-drill-tablehost .ctsv-table-scroll { overflow: visible; }
/* Đầu bảng (thead) dính khi cuộn danh sách */
.ctsv-drill .ctsv-table thead th { position: sticky; top: 0; z-index: 1; }
.ctsv-drill-count { margin-top: 0.5rem; font-size: 0.78rem; color: var(--text-muted); text-align: right; flex: 0 0 auto; }

/* Card biểu đồ bấm được (đào tạo/tuyển sinh) → mở dữ liệu nguồn thật */
.dao-tao-dashboard .chart-wrap,
.view-tuyen-sinh .chart-wrap { position: relative; }
.chart-wrap.dt-clickable { cursor: pointer; }
.chart-wrap.dt-clickable:hover { border-color: var(--accent); box-shadow: 0 4px 14px -6px rgba(154, 24, 60, 0.35); }

/* ===== Popup thông báo dùng chung (thay alert/confirm trình duyệt) ===== */
.bcqt-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(43, 24, 18, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.bcqt-modal-overlay[hidden] { display: none; }
.bcqt-modal {
  background: var(--bg-elevated, #fff); color: var(--text, #2b1812);
  border: 1px solid var(--border, #e3d3cf); border-left: 5px solid var(--accent, #9A183C);
  border-radius: 12px;
  /* Chặn cả hai chiều: popup thông báo không được phình gần kín màn hình.
     min() để trên màn lớn vẫn giữ kích thước vừa mắt, màn nhỏ thì co theo khung. */
  width: min(420px, calc(100vw - 2rem));
  max-height: min(520px, 80vh);
  display: flex; flex-direction: column;
  box-shadow: 0 18px 48px -12px rgba(43, 24, 18, 0.35);
  padding: 1.1rem 1.2rem 0.9rem;
}
.bcqt-modal-ok     { border-left-color: #2e7d52; }
.bcqt-modal-warn   { border-left-color: #d49c11; }
.bcqt-modal-danger { border-left-color: #b91c1c; }
.bcqt-modal-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem; flex: 0 0 auto; }
.bcqt-modal-icon { font-size: 1.15rem; line-height: 1; }
.bcqt-modal-title { margin: 0; font-size: 1rem; font-weight: 700; }
.bcqt-modal-body {
  font-size: 0.9rem; line-height: 1.55; color: var(--text, #2b1812);
  /* Phần chữ là chỗ co giãn: dài quá thì tự cuộn, đầu và chân popup luôn thấy được */
  flex: 1 1 auto; min-height: 0;
  max-height: min(300px, 38vh); overflow-y: auto; overflow-wrap: anywhere;
}
.bcqt-modal-input {
  display: block; width: 100%; margin-top: 0.7rem;
  font: inherit; font-size: 0.9rem; color: var(--text, #2b1812);
  padding: 0.48rem 0.6rem; background: #fff;
  border: 1.5px solid var(--border, #e3d3cf); border-radius: 8px;
}
.bcqt-modal-input:focus { outline: none; border-color: var(--accent, #9A183C); }
.bcqt-modal-input::placeholder { color: var(--text-muted, #9ca3af); }
.bcqt-modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; flex: 0 0 auto; }
.bcqt-btn {
  font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  padding: 0.45rem 0.95rem; border-radius: 8px; border: 1.5px solid transparent;
}
.bcqt-btn-primary { background: var(--accent, #9A183C); color: #fff; }
.bcqt-btn-primary:hover { filter: brightness(1.08); }
.bcqt-btn-ghost {
  background: transparent; color: var(--text-muted, #5c4d47);
  border-color: var(--border, #e3d3cf);
}
.bcqt-btn-ghost:hover { background: var(--surface, #f6efef); }
.bcqt-btn:focus-visible { outline: 2px solid var(--accent, #9A183C); outline-offset: 2px; }

/* Toast: thông báo trôi góc dưới phải, không chặn thao tác */
.bcqt-toast-wrap {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 9100;
  display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none;
}
.bcqt-toast {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: var(--bg-elevated, #fff); color: var(--text, #2b1812);
  border: 1px solid var(--border, #e3d3cf); border-left: 4px solid var(--accent, #9A183C);
  border-radius: 10px; padding: 0.6rem 0.85rem; font-size: 0.85rem; max-width: 380px;
  box-shadow: 0 10px 28px -10px rgba(43, 24, 18, 0.3);
  animation: bcqt-toast-in 0.2s ease-out;
}
.bcqt-toast-ok   { border-left-color: #2e7d52; }
.bcqt-toast-warn { border-left-color: #d49c11; }
.bcqt-toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity 0.3s, transform 0.3s; }
@keyframes bcqt-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .bcqt-toast { animation: none; }
  .bcqt-toast.is-out { transition: none; }
}

/* Bảng lịch sử nạp dữ liệu: cao vừa ~10 bản, quá thì cuộn trong bảng (không kéo dài modal).
   Header bảng dính khi cuộn để luôn thấy tên cột. */
.ib-history-scroll { max-height: 58vh; overflow-y: auto; }
.ib-history-scroll thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface, #f6efef);
}
.ib-history-scroll .ib-sub {
  font-size: 0.72rem; color: var(--text-muted, #5c4d47); margin-top: 0.15rem;
}
/* Cột "Thao tác" của bảng lịch sử: 2 nút (Tải file / Khôi phục) xuống dòng khi hẹp */
.ib-acts { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* Hộp LỊCH SỬ: .ctsv-drill cố định height 82vh (hợp cho danh sách SV dài), nhưng lịch sử
   tối đa 10 dòng nên bị thừa khoảng trắng phía dưới → cho co theo nội dung. */
.ctsv-drill.ib-history-box {
  height: auto;
  max-height: 88vh;
  max-width: 900px;
}
.ctsv-drill.ib-history-box .ctsv-drill-body { overflow: auto; }
.ctsv-drill.ib-history-box .ib-history-scroll { max-height: none; overflow: visible; }

/* ===== Quản lý tài khoản: tab, ma trận phân quyền, toàn cảnh theo mảng ===== */
.acc-tabs {
  display: flex; gap: 0.25rem; margin-bottom: 1rem;
  padding-bottom: 0.35rem; border-bottom: 2px solid var(--border);
}
.acc-tab {
  padding: 0.45rem 0.9rem; border: 1px solid transparent; border-bottom: none;
  border-radius: 9px 9px 0 0; background: transparent;
  font: inherit; font-size: 0.88rem; font-weight: 700;
  color: var(--text-muted); cursor: pointer; margin-bottom: -0.35rem;
}
.acc-tab:hover { background: var(--surface); color: var(--text); }
.acc-tab.is-on {
  background: var(--bg-elevated); color: var(--accent); border-color: var(--border);
  box-shadow: 0 2px 0 0 var(--bg-elevated);
}
.acc-grow { flex: 1 1 auto; }
.acc-field-hint { display: block; font-size: 0.74rem; color: var(--text-muted); margin-top: 0.2rem; line-height: 1.45; }
.acc-dim { color: var(--text-muted); }

/* --- thanh gán hàng loạt --- */
.acc-bulk {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  padding: 0.55rem 0.8rem; margin-bottom: 0.7rem;
  border: 1px solid var(--accent); border-radius: 10px;
  background: var(--accent-dim);
}
.acc-bulk-n { font-size: 0.86rem; }
.acc-bulk-f { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--text-muted); }
.acc-bulk-f select { min-width: 130px; }

/* --- bảng tài khoản --- */
.acc-users, .acc-roles { width: 100%; font-size: 0.84rem; }
.acc-users th, .acc-users td, .acc-roles th, .acc-roles td { padding: 0.4rem 0.5rem; vertical-align: top; }
.acc-users td.ell { text-overflow: ellipsis; white-space: nowrap; max-width: 0; overflow: hidden; }
.acc-c-chk { width: 34px; text-align: center; }
.acc-c-act { width: 128px; text-align: right; white-space: nowrap; }
.acc-c-roles { width: 23%; }
.acc-c-perms { width: 26%; }
.acc-c-num { width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.acc-u-name { font-weight: 600; }
.acc-u-sub { font-size: 0.74rem; color: var(--text-muted); line-height: 1.4; }
.acc-tag { font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.3rem; border-radius: 4px; vertical-align: middle; }
.acc-tag-lock { background: #fdeceb; color: #b3261e; }
.acc-tag-builtin { background: var(--surface); color: var(--text-muted); }
.acc-btn-xs { padding: 0.22rem 0.5rem; font-size: 0.75rem; }

/* chip quyền hiệu lực: mảng + làm được gì */
.acc-pill {
  display: inline-flex; align-items: baseline; gap: 0.3rem;
  padding: 0.1rem 0.42rem; margin: 0 0.15rem 0.2rem 0;
  border-radius: 999px; font-size: 0.74rem; border: 1px solid var(--border);
}
.acc-pill i { font-style: normal; font-size: 0.68rem; opacity: 0.8; }
.acc-pill-edit { background: #eef8f2; border-color: #b7ddc7; color: #1f6b45; }
.acc-pill-view { background: #eef7fb; border-color: #bcdcea; color: #0b6e99; }
.acc-pill-admin { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* dấu quyền trong bảng vai trò */
.acc-permhdr { display: inline-flex; gap: 0.3rem; margin-left: 0.4rem; }
.acc-permhdr i { font-style: normal; font-size: 0.68rem; width: 12px; text-align: center; color: var(--text-muted); }
.acc-permrow { display: inline-flex; gap: 0.3rem; }
.acc-permdot { width: 12px; text-align: center; color: #d6cdc9; font-size: 0.8rem; }
.acc-permdot.is-on { color: #287a52; }
.acc-permdot.is-on.is-admin { color: var(--accent); }

/* --- toàn cảnh theo mảng --- */
/* --- toàn cảnh theo mảng --- */
.acc-admins {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  padding: 0.5rem 0.75rem; margin-bottom: 0.9rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elevated);
}
.acc-admins-lbl {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-muted); margin-right: 0.2rem;
}
.acc-overview { width: 100%; font-size: 0.85rem; }
.acc-overview td { vertical-align: top; padding: 0.5rem 0.6rem; }
.acc-overview .acc-chip { margin: 0 0.15rem 0.2rem 0; }
.acc-row-warn { background: #fffaf0; }
.acc-warn-note { font-size: 0.74rem; color: #a3690b; margin-top: 0.2rem; font-weight: 600; }
.acc-chip {
  display: inline-block; padding: 0.12rem 0.45rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.76rem; color: var(--text);
}

/* --- form phân quyền trong hộp thoại --- */
.acc-acl { display: flex; flex-direction: column; gap: 0.3rem; }
.acc-acl.is-muted { opacity: 0.45; }
.acc-acl-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.acc-acl-name { font-size: 0.84rem; }
.acc-acl-sel { width: 130px; flex: 0 0 auto; }
.acc-adminchk { display: flex; align-items: flex-start; gap: 0.45rem; font-size: 0.84rem; line-height: 1.4; }
.acc-adminchk input { margin-top: 0.2rem; flex: 0 0 auto; }

/* --- hộp thoại của màn tài khoản: cũng có trần như các popup khác --- */
.acc-modal-ov {
  position: fixed; inset: 0; z-index: 920;
  background: rgba(35, 21, 16, 0.44);
  display: grid; place-items: center; padding: 1.2rem;
}
.acc-modal {
  width: min(480px, calc(100vw - 2rem));
  max-height: min(620px, 84vh);
  display: flex; flex-direction: column;
  background: var(--bg-elevated); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden;
}
.acc-modal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border);
  font-size: 0.95rem; flex: 0 0 auto;
}
.acc-modal-x {
  width: 26px; height: 26px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-muted); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.acc-modal-x:hover { background: var(--surface); color: var(--accent); }
.acc-modal-b { padding: 0.9rem; overflow: auto; flex: 1 1 auto; min-height: 0; }
.acc-modal-f {
  display: flex; justify-content: flex-end; gap: 0.4rem;
  padding: 0.7rem 0.9rem; border-top: 1px solid var(--border); flex: 0 0 auto;
}
.acc-field { display: block; margin-bottom: 0.7rem; }
.acc-field-label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.25rem; }
.acc-input {
  width: 100%; padding: 0.42rem 0.55rem; font: inherit; font-size: 0.86rem;
  color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 8px;
}
.acc-input:focus { outline: none; border-color: var(--accent); }
.acc-pw-row { display: flex; align-items: center; gap: 0.4rem; }

/* ===== Phân quyền theo vai trò: danh sách vai trò, form quyền/mảng ===== */
.acc-dlg-help { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 0.7rem; }
.acc-rolelist {
  display: flex; flex-direction: column; gap: 0.2rem;
  max-height: 300px; overflow: auto;
  border: 1px solid var(--border); border-radius: 9px; padding: 0.35rem;
}
.acc-rolerow {
  display: flex; align-items: flex-start; gap: 0.45rem;
  padding: 0.3rem 0.4rem; border-radius: 7px; cursor: pointer;
}
.acc-rolerow:hover { background: var(--surface); }
.acc-rolerow.is-admin { background: #fff8f9; }
.acc-rolerow input { margin-top: 0.25rem; flex: 0 0 auto; }
.acc-rolerow-main { font-size: 0.84rem; line-height: 1.4; }
.acc-rolerow-sub { display: block; font-size: 0.74rem; color: var(--text-muted); }

.acc-modal.is-wide { width: min(620px, calc(100vw - 2rem)); }
.acc-permbox, .acc-segbox {
  border: 1px solid var(--border); border-radius: 9px; padding: 0.4rem 0.5rem;
  max-height: 260px; overflow: auto;
}
.acc-permbox.is-muted, .acc-segbox.is-muted { opacity: 0.45; }
.acc-field.is-muted { opacity: 0.55; }
.acc-permgroup {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); margin: 0.45rem 0 0.2rem;
}
.acc-permgroup:first-child { margin-top: 0; }
.acc-permrow2 {
  display: flex; align-items: flex-start; gap: 0.45rem;
  padding: 0.25rem 0.3rem; border-radius: 7px; cursor: pointer; font-size: 0.84rem;
}
.acc-permrow2:hover { background: var(--surface); }
.acc-permrow2.is-admin { background: #fff8f9; }
.acc-permrow2 input { margin-top: 0.25rem; flex: 0 0 auto; }
.acc-segbox { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.15rem 0.5rem; }
.acc-segrow {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.2rem 0.3rem; border-radius: 6px; font-size: 0.84rem; cursor: pointer;
}
.acc-segrow:hover { background: var(--surface); }
.acc-segrow.is-all { grid-column: 1 / -1; border-bottom: 1px dashed var(--border); padding-bottom: 0.3rem; margin-bottom: 0.15rem; }
.acc-chip.is-admin { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.acc-chip i { font-style: normal; font-size: 0.68rem; opacity: 0.75; }
.acc-leg { display: inline-block; margin-right: 0.8rem; white-space: nowrap; }
.acc-leg b {
  display: inline-block; width: 14px; height: 14px; line-height: 14px; text-align: center;
  border-radius: 3px; background: var(--surface); font-size: 0.66rem; margin-right: 0.2rem;
}
