/* ============================================================
   CSS riêng của Chấm điểm HTNV (bổ sung cho site.css + mvc.css của EnterpriseStarter).
   Dùng cùng bảng màu: đỏ var(--brand), viền #e5e7eb, chữ phụ #6b7280.
   ============================================================ */

/* ---- Khung: trang chưa đăng nhập không có sidebar ---- */
.shell--bare .shell__main { margin-left: 0 !important; }
.shell__group { margin: 14px 14px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9ca3af; }
.userpill__info { padding: 8px 14px; font-size: .82rem; color: #6b7280; border-bottom: 1px solid #e5e7eb; max-width: 260px; }
.userpill__menu a { display: block; padding: 10px 14px; color: #1f2937; }
.userpill__menu a:hover { background: #f3f4f6; }
.login__note { margin-top: 14px; font-size: .8rem; text-align: center; }

/* ---- Tiện ích chung ---- */
.mt { margin-top: 16px; }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.page-desc { margin: -8px 0 16px; }
.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel__headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel__headrow h2 { margin: 0; }
.table tr.is-muted td { opacity: .55; }
.badge-soft { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: #fef3c7; color: #92400e; font-size: .7rem; font-weight: 600; }
.readonly { padding: 9px 0; font-weight: 700; }
.text-ok { color: #16a34a; }
.text-down { color: #dc2626; }

/* ---- Form ---- */
.form--narrow { max-width: 480px; }
.form__row--3 { grid-template-columns: repeat(3, 1fr); }
.form__row--4 { grid-template-columns: repeat(4, 1fr); align-items: end; }
.form__row--ma { grid-template-columns: 110px 140px 1fr; align-items: end; }
.field--wide { grid-column: span 2; }
.check-line { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: .92rem; cursor: pointer; }
.check-line--sub { margin: 0 0 0 26px; font-size: .8rem; color: #6b7280; }
.form__actions--sticky { position: sticky; bottom: 0; z-index: 5; padding: 12px 0; background: linear-gradient(transparent, #fff 30%); }
@media (max-width: 900px) {
    .form__row--3, .form__row--4 { grid-template-columns: 1fr 1fr; }
    .field--wide { grid-column: auto; }
}
@media (max-width: 600px) {
    .form__row--3, .form__row--4, .form__row--ma { grid-template-columns: 1fr; }
}

/* ---- Tổng quan ---- */
a.stat--link { display: block; color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
a.stat--link:hover { box-shadow: 0 4px 14px rgb(17 24 39 / 10%); transform: translateY(-1px); }
.stats--compact .stat { padding: 12px 14px; }
.stats--compact .stat__value { font-size: 1.4rem; }
.kv { margin: 0 0 10px; }
.timeline { list-style: none; margin: 0 0 10px; padding: 0; }
.timeline li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #e5e7eb; }
.countdown { margin: 8px 0 0; padding: 10px 12px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-dark); }
.warn-list { list-style: none; margin: 0; padding: 0; }
.warn-list li { position: relative; padding: 7px 0 7px 18px; border-bottom: 1px solid #f3f4f6; font-size: .9rem; }
.warn-list li::before { content: ''; position: absolute; left: 2px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: #d97706; }
.warn-list li.is-error::before { background: #dc2626; }
.warn-list--scroll { max-height: 260px; overflow-y: auto; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 7px 0; border-bottom: 1px solid #f3f4f6; font-size: .9rem; }
.activity time { display: inline-block; min-width: 130px; color: #6b7280; font-variant-numeric: tabular-nums; }
.activity strong { margin-right: 6px; }
.notice-panel { border-left: 4px solid var(--brand); }
.help-list { margin: 0 0 12px; padding-left: 18px; line-height: 1.6; }

/* ---- Kỳ đánh giá: lưới chọn đơn vị ---- */
.unit-group { margin-bottom: 10px; border: 1px solid #e5e7eb; border-radius: 8px; }
.unit-group > summary { padding: 10px 14px; font-weight: 600; cursor: pointer; background: #f9fafb; border-radius: 8px; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 18px; padding: 10px 14px; }
.unit-row { padding: 6px 0; border-bottom: 1px dashed #f3f4f6; }
.unit-row .check-line { margin-bottom: 2px; }

/* ---- Trình soạn cây tiêu chí ---- */
.panel--warn { border-left: 4px solid #d97706; }
.editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); gap: 20px; align-items: start; }
.editor__side { position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow-y: auto; }
.editor__treehead { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }
.editor__treehead .searchbox { flex: 1; min-width: 200px; }
@media (max-width: 1100px) {
    .editor { grid-template-columns: 1fr; }
    .editor__side { position: static; max-height: none; }
}

.ctree, .ctree__list { list-style: none; margin: 0; padding: 0; }
.ctree { padding: 6px 0; max-height: calc(100vh - 260px); overflow-y: auto; }
.ctree__list { padding-left: 20px; border-left: 1px dashed #e5e7eb; margin-left: 18px; }
.ctree__row { display: flex; align-items: flex-start; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 6px; }
.ctree__row:hover { background: #f9fafb; }
.ctree__row.is-active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.ctree__caret { display: inline-flex; flex: none; width: 22px; height: 22px; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; color: #6b7280; cursor: pointer; border-radius: 4px; transform: rotate(-90deg); transition: transform .15s; }
.ctree__caret.is-open { transform: none; }
.ctree__caret.is-leaf { cursor: default; }
.ctree__caret:hover:not(.is-leaf) { background: #e5e7eb; }
.ctree__link { display: flex; gap: 8px; flex: 1; min-width: 0; color: #1f2937; text-decoration: none; line-height: 1.4; padding-top: 1px; }
.ctree__link:hover { color: var(--brand); }
.ctree__ma { flex: none; min-width: 26px; font-weight: 700; color: #374151; }
.ctree__ten { flex: 1; min-width: 0; font-size: .9rem; }
.ctree__row--c1 .ctree__ten, .ctree__row--c1 .ctree__ma { font-weight: 700; text-transform: uppercase; color: var(--brand-dark); }
.ctree__row--c2 .ctree__ten { font-weight: 600; }
.ctree__diem { flex: none; min-width: 42px; padding: 1px 8px; border-radius: 999px; background: #f3f4f6; font-size: .8rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.ctree__diem.is-bad { background: #fee2e2; color: #b91c1c; }
.ctree__row.is-warn .ctree__ma { color: #b91c1c; }
.node-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e5e7eb; }

/* ---- Cấu hình công thức ---- */
.formula { margin: 4px 0 14px; padding: 12px 14px 2px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fafafa; }
.formula > legend { padding: 0 6px; font-size: .85rem; font-weight: 700; color: var(--brand-dark); }
.formula--parent { opacity: .75; }
.ctree__kieu { flex: none; padding: 0 6px; border-radius: 4px; font-size: .7rem; font-weight: 700; line-height: 1.6; background: #eef2ff; color: #3730a3; }
.ctree__kieu--ChamTay { background: #f3f4f6; color: #6b7280; }
.ctree__kieu--GiamTheoLan { background: #fff7ed; color: #9a3412; }
.ctree__kieu--BacThang, .ctree__kieu--Nguong { background: #ecfdf5; color: #065f46; }
.ctree__kieu--ChonMuc { background: #fdf4ff; color: #86198f; }
.ctree__kieu--NhieuTyLe { background: #eff6ff; color: #1e40af; }
.ctree__kieu--tt { background: var(--brand-soft); color: var(--brand-dark); }

/* ---- Thử tính ---- */
.thu-tinh { margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--brand); border-radius: 8px; background: #fffafa; }
.thu-tinh h3 { margin: 0 0 10px; font-size: 1rem; }
.thu-tinh__inputs { display: flex; flex-wrap: wrap; gap: 10px; }
.thu-tinh__inputs .field { margin-bottom: 8px; min-width: 140px; flex: 1; }
.thu-tinh__inputs .field > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.thu-tinh__opts { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.thu-tinh__opts .check-line { margin: 0; }
.thu-tinh__kq { margin-top: 10px; padding: 10px 12px; border-radius: 6px; }
.thu-tinh__kq.is-ok { background: #dcfce7; color: #14532d; }
.thu-tinh__kq.is-err { background: #fee2e2; color: #991b1b; }

/* ---- Nhập Excel ---- */
.upload-row { display: grid; grid-template-columns: minmax(0, 2fr) 160px auto; gap: 14px; align-items: end; }
@media (max-width: 700px) { .upload-row { grid-template-columns: 1fr; } }
.import-sheet { margin-bottom: 16px; padding: 14px; border: 1px solid #e5e7eb; border-radius: 8px; }
.import-sheet__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.import-sheet__head .check-line { margin: 0; font-size: 1rem; }
.import-sheet__stats { display: flex; gap: 6px; flex-wrap: wrap; }
.import-sheet__detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .import-sheet__detail { grid-template-columns: 1fr; } }
.chips-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-soft { padding: 2px 10px; border-radius: 999px; background: #f3f4f6; font-size: .8rem; }
.tag--bad { background: #fee2e2 !important; color: #b91c1c !important; }

/* ============================================================
   HỒ SƠ CHẤM ĐIỂM
   ============================================================ */
.notice-bar { margin: 0 0 16px; padding: 10px 14px; border-radius: 6px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.cd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.cd-side { position: sticky; top: 82px; }
@media (max-width: 1100px) { .cd-layout { grid-template-columns: 1fr; } .cd-side { position: static; order: -1; } }
.cd-toolbar { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.cd-toolbar .check-line { margin: 0; }

.cd-sec { margin-bottom: 10px; }
.cd-sec__head { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: 6px; }
.cd-sec--c1 > .cd-sec__head { background: var(--brand-dark); color: #fff; text-transform: uppercase; font-weight: 700; }
.cd-sec--c2 > .cd-sec__head { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.cd-sec--c3 > .cd-sec__head, .cd-sec--c4 > .cd-sec__head { background: #f9fafb; font-weight: 600; border: 1px solid #f3f4f6; }
.cd-sec .cd-sec { margin-left: 14px; }
.cd-sec .cd-leaf { margin-left: 14px; }
.cd-sec__score { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.cd-td { margin-left: 8px; padding: 0 6px; border-radius: 4px; background: rgb(255 255 255 / 70%); color: #065f46; font-size: .85em; }
.cd-sec--c1 .cd-td { color: #065f46; }
.cd-ma { flex: none; min-width: 22px; font-weight: 700; }
.cd-ten { flex: 1; min-width: 0; }
.cd-sec.is-skip, .cd-leaf.is-skip { opacity: .5; }

.cd-leaf { margin: 8px 0 12px; padding: 12px 14px; border: 1px solid #e5e7eb; border-left: 4px solid #16a34a; border-radius: 8px; background: #fff; }
.cd-leaf.is-todo { border-left-color: #d97706; }
.cd-leaf__head { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.cd-max { flex: none; color: #6b7280; font-size: .82rem; font-weight: 500; }
.cd-leaf__meta { margin: 4px 0 8px; }
.cd-help summary { cursor: pointer; color: var(--brand); }
.cd-help .pre { white-space: pre-line; margin: 6px 0; }
.cd-cols { display: grid; gap: 12px; }
.cd-cols--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .cd-cols--2 { grid-template-columns: 1fr; } }
.cd-block { position: relative; padding: 10px 12px; border-radius: 6px; background: #f9fafb; }
.cd-block--td { background: #f0fdf4; }
.cd-block__title { margin-bottom: 6px; font-size: .82rem; font-weight: 700; text-transform: uppercase; color: #6b7280; }
.cd-inputs { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.cd-inputs .field { flex: 1; min-width: 130px; margin-bottom: 8px; }
.cd-inputs .field > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; font-size: .78rem; }
.cd-mucs .check-line { margin-bottom: 4px; }
.cd-opts { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.cd-opts .check-line { margin-bottom: 6px; font-size: .85rem; }
.cd-block .field textarea { min-height: 54px; }
.cd-kq { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; border-radius: 6px; font-size: .88rem; }
.cd-kq__diem { flex: none; min-width: 34px; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cd-kq.is-ok { background: #dcfce7; color: #14532d; }
.cd-kq.is-err { background: #fee2e2; color: #991b1b; }
.cd-kq.is-empty { background: #f3f4f6; color: #6b7280; }
.cd-save { position: absolute; top: 8px; right: 10px; font-size: .75rem; color: #6b7280; }
.cd-save.is-ok { color: #16a34a; }
.cd-save.is-err { color: #dc2626; }
.cd-files { margin-top: 8px; }
.cd-files__list { list-style: none; margin: 0 0 6px; padding: 0; font-size: .86rem; }
.cd-files__list li { padding: 2px 0; }
.cd-upload { cursor: pointer; }

.cd-sum h2 { display: flex; align-items: center; gap: 8px; }
.cd-sum__row { padding: 10px 0; border-bottom: 1px solid #f3f4f6; }
.cd-sum__label { font-size: .78rem; font-weight: 700; text-transform: uppercase; color: #6b7280; }
.cd-sum__big { font-size: 1.9rem; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.cd-sum__big small { font-size: .9rem; color: #6b7280; font-weight: 600; }
.progress-bar { height: 8px; margin: 6px 0 4px; border-radius: 999px; background: #f3f4f6; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.progress-bar--td > span { background: #16a34a; }
.col-progress { min-width: 110px; }
.col-progress .progress-bar { margin: 2px 0; }
.table__group td { background: #f9fafb; font-weight: 700; color: var(--brand-dark); }
.xl-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 15%, white); color: var(--c); font-size: .8rem; font-weight: 700; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; }
.live-dot.is-on { background: #16a34a; box-shadow: 0 0 0 3px rgb(22 163 74 / 20%); }

/* ============================================================
   GIAO DIỆN "DANH SÁCH GỌN + POPUP" (Thiết lập > Giao diện chấm điểm)
   ============================================================ */
.cd-leaf.cd-leaf--gon { margin-top: 4px; margin-bottom: 4px; padding: 8px 12px; }
.cd-leaf--gon > .cd-leaf__body { display: none; }
.cd-leaf.is-open { box-shadow: 0 0 0 2px var(--brand); }
.cd-row { display: flex; align-items: center; gap: 10px; }
.cd-row__ten { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cd-row__ten .cd-ten { font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cd-row__diem { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cd-row__btn { flex: none; min-width: 96px; }
.cd-row__na { flex: none; }
.cd-chip { display: inline-block; min-width: 82px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cd-chip.is-ok { background: #dcfce7; color: #14532d; }
.cd-chip.is-empty { background: #fff7ed; color: #9a3412; }
.cd-chip.is-err { background: #fee2e2; color: #991b1b; }
.cd-chip--td.is-ok { background: #ecfdf5; color: #065f46; box-shadow: inset 0 0 0 1px #a7f3d0; }
.cd-chip--td.is-empty { background: #f3f4f6; color: #6b7280; }
@media (max-width: 640px) {
  .cd-row { flex-wrap: wrap; }
  .cd-row__ten { flex-basis: calc(100% - 40px); }
  .cd-row__diem { flex-direction: row; margin-left: 32px; }
  .cd-row__btn { margin-left: auto; }
}

.cd-modal { width: min(940px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 20px 50px rgb(0 0 0 / 30%); color: inherit; }
.cd-modal[open] { display: flex; flex-direction: column; animation: fade-up .2s ease-out; }
.cd-modal::backdrop { background: rgb(17 24 39 / 50%); }
.cd-modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #f3f4f6; }
.cd-modal__info { flex: 1; min-width: 0; }
/* Tên đơn vị đang chấm / thẩm định: nổi bật để người thẩm định không nhầm hồ sơ */
.cd-modal__dv { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-bottom: 6px; padding: 3px 10px;
    border-radius: 999px; background: #1e3a8a; color: #fff; font-size: .9rem; font-weight: 700; }
.cd-modal__dv svg { flex: none; width: 15px; height: 15px; }
.cd-modal__dv span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-modal__ma { font-size: .8rem; font-weight: 700; color: var(--brand-dark); }
.cd-modal__head h2 { margin: 2px 0 0; font-size: 1.02rem; line-height: 1.45; }
.cd-modal__x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; font-size: 1rem; color: #6b7280; cursor: pointer; }
.cd-modal__x:hover { background: #f3f4f6; color: #111827; }
.cd-modal__body { flex: 1; min-height: 0; overflow: auto; padding: 12px 18px 16px; }
.cd-modal__body .cd-leaf__meta { margin-top: 0; }
.cd-modal__foot { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-top: 1px solid #f3f4f6; background: #f9fafb; border-radius: 0 0 12px 12px; }
.cd-modal__hint { margin-left: auto; }
@media (max-width: 640px) {
  .cd-modal { inset: 0; margin: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .cd-modal__foot { flex-wrap: wrap; border-radius: 0; }
  .cd-modal__hint { display: none; }
  .cd-modal__foot .js-dong { margin-left: auto; }
}

/* Trang Thiết lập: chọn giao diện */
.ui-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 12px 0; }
.ui-opt { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 2px solid #e5e7eb; border-radius: 10px; cursor: pointer; background: #fff; }
.ui-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.ui-opt > input { position: absolute; top: 14px; right: 14px; accent-color: var(--brand); }
.ui-opt__text { display: flex; flex-direction: column; gap: 4px; }
.ui-opt__pic { position: relative; display: flex; flex-direction: column; gap: 5px; height: 120px; padding: 10px; border-radius: 6px; background: #f3f4f6; overflow: hidden; }
.ui-sk { display: block; border-radius: 4px; }
.ui-sk--sec { height: 10px; width: 55%; background: var(--brand-dark); }
.ui-sk--card { display: flex; flex-direction: column; gap: 4px; padding: 6px; background: #fff; border-left: 3px solid #16a34a; }
.ui-sk--card i { display: block; height: 6px; border-radius: 3px; background: #e5e7eb; }
.ui-sk--row { display: flex; align-items: center; gap: 6px; height: 16px; padding: 0 6px; background: #fff; border-left: 3px solid #16a34a; }
.ui-sk--row i { flex: 1; height: 5px; border-radius: 3px; background: #e5e7eb; }
.ui-sk--row b { width: 26px; height: 8px; border-radius: 999px; background: #bbf7d0; }
.ui-sk--pop { position: absolute; right: 14px; bottom: 10px; display: flex; flex-direction: column; gap: 5px; width: 46%; padding: 8px; background: #fff; box-shadow: 0 6px 18px rgb(0 0 0 / 20%); }
.ui-sk--pop i { display: block; height: 6px; border-radius: 3px; background: var(--brand-line); }
.ui-sk .w60, .ui-sk--pop .w60 { width: 60%; }

/* ============================================================
   CHUÔNG BÁO (thanh trên) - realtime.js
   ============================================================ */
.bell { position: relative; }
.bell__btn { position: relative; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / 16%); color: #fff; cursor: pointer; }
.bell__btn:hover, .bell__btn:focus-visible { background: rgb(255 255 255 / 28%); outline: none; }
.bell__btn svg { width: 22px; height: 22px; }
.bell.is-off .bell__btn { opacity: .75; }
.bell__badge { position: absolute; top: -3px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #fff; color: var(--brand); font-size: .72rem; font-weight: 800; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px var(--brand); }
.bell__btn.is-ring svg { animation: bell-ring .9s ease-in-out; transform-origin: 50% 10%; }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); } 45% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .bell__btn.is-ring svg { animation: none; } }
.bell__panel { position: absolute; right: -8px; top: calc(100% + 10px); z-index: 60; width: min(380px, calc(100vw - 24px)); background: #fff; color: #111827; border-radius: 10px; box-shadow: 0 4px 24px rgb(17 24 39 / 18%); }
.bell__head, .bell__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; }
.bell__head { border-bottom: 1px solid #f3f4f6; }
.bell__foot { border-top: 1px solid #f3f4f6; font-size: .85rem; }
.bell__list { max-height: min(420px, 60vh); margin: 0; padding: 4px 0; overflow: auto; list-style: none; }
.bell__item a { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px 8px 22px; position: relative; color: inherit; text-decoration: none; }
.bell__item a:hover { background: #f9fafb; }
.bell__item.is-new a::before { content: ""; position: absolute; left: 9px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.bell__item.is-new .bell__text { font-weight: 600; }
.bell__item--nop .bell__text::after, .bell__item--molai .bell__text::after { content: " ●"; color: #d97706; font-size: .7em; vertical-align: middle; }
.bell__text { font-size: .9rem; line-height: 1.35; }
.bell__meta { font-size: .76rem; color: #6b7280; }
.bell__empty { padding: 18px 14px; color: #6b7280; font-size: .9rem; text-align: center; }

/* Vùng tự làm mới / số liệu vừa cập nhật */
.is-flash { animation: tk-flash 1.2s ease-out; }
@keyframes tk-flash { from { background-color: #fef9c3; } to { background-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .is-flash { animation: none; } }

/* ============================================================
   THỐNG KÊ - BÁO CÁO
   ============================================================ */
.tk-actions .input { width: auto; max-width: 260px; }
.tk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.tk-live { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: #fff; }
.seg__btn { max-width: 260px; padding: 7px 12px; border: 0; border-right: 1px solid #e5e7eb; background: transparent; color: #374151; font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg__btn:last-child { border-right: 0; }
.seg__btn:hover { background: #f9fafb; }
.seg__btn.is-active { background: var(--brand); color: #fff; }
.tk-panel h2 { font-size: 1.02rem; }
.tk-note { margin: -8px 0 12px; }
.tk-scroll { overflow-x: auto; }
.tk-scroll .chart { min-width: 560px; }
/* Biểu đồ Thống kê vẽ 1:1 theo bề rộng khung → chữ cùng cỡ chữ chung (nhãn = cỡ bảng .88rem) */
.tk-panel .chart { width: auto; max-width: none; }
.tk-panel .chart__label { font-size: .88rem; fill: #1f2937; }
.tk-panel .chart__tick { font-size: .8rem; }
.tk-panel .chart__val, .tk-panel .chart__in { font-size: .82rem; }
.tk-panel .chart__reflabel { font-size: .75rem; }
.tk-panel .legend { font-size: .88rem; margin-bottom: 12px; }
.tk-panel .tk-abbr { font-weight: 700; }
.tk-table abbr[title] { text-decoration: underline dotted #9ca3af; text-underline-offset: 3px; cursor: help; }
.tk-table th { white-space: nowrap; }
.chart__label { font-size: 12px; fill: #374151; }
.chart__val { font-size: 11px; fill: #111827; font-weight: 600; }
.chart__in { font-size: 11px; fill: #111827; font-weight: 700; }
.chart__in.is-dark { fill: #fff; }
.chart__ref { stroke: #6b7280; stroke-width: 1; stroke-dasharray: 3 3; }
.chart__reflabel { font-size: 10px; fill: #6b7280; }
.tk-table { font-size: .88rem; }
.tk-table--num td.num, .tk-table--num th { text-align: right; }
.tk-table--num td:first-child, .tk-table--num th:first-child, .tk-table--num td:nth-child(2):not(.num) { text-align: left; }
.tk-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tk-table--heat td.tk-heat { color: #0b1f3a; }
.tk-table--heat td.tk-heat.is-dark { color: #fff; }
.tk-table--heat th { vertical-align: bottom; }
.tk-scale { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; font-size: .8rem; color: #6b7280; }
.tk-scale i { width: 26px; height: 12px; }
.tk-scale i:first-of-type { border-radius: 3px 0 0 3px; }
.tk-scale i:last-of-type { border-radius: 0 3px 3px 0; }
.tk-mucs { margin: 10px 0 0; padding-left: 18px; columns: 2; }
.tk-td { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; white-space: nowrap; background: #f3f4f6; color: #374151; }
.tk-td--DangTuCham { background: #e8f1fd; color: #1c5cab; }
.tk-td--ChoThamDinh, .tk-td--DangThamDinh { background: #dbeafe; color: #184f95; }
.tk-td--DaThamDinh { background: #0d366b; color: #fff; }
.tk-tip { position: fixed; z-index: 3000; max-width: 360px; padding: 6px 10px; border-radius: 6px; background: #111827; color: #fff; font-size: .8rem; line-height: 1.4; pointer-events: none; box-shadow: 0 4px 14px rgb(0 0 0 / 25%); }
@media (max-width: 700px) { .tk-live { margin-left: 0; } .tk-mucs { columns: 1; } }
@media print {
  .shell__header, .shell__sidebar, .shell__backdrop, .tk-bar, .tk-actions, #tkTabs, .toast-container { display: none !important; }
  .shell__main { margin: 0 !important; padding: 0 !important; }
  .tk-panel { break-inside: avoid; border: 0; padding: 0; }
  .two-col { grid-template-columns: 1fr !important; }
}

/* ============================================================
   KIỂM TRA SỐ LIỆU NHẬP (chấm điểm)
   ============================================================ */
.cd-kq.is-warn { background: #fff7ed; color: #9a3412; }
.cd-chip.is-warn { background: #fff7ed; color: #9a3412; }
.field-err { display: block; margin-top: 3px; color: #b91c1c; font-size: .76rem; line-height: 1.3; }
.cd-inputs input[aria-invalid="true"], .cd-block textarea[aria-invalid="true"] { border-color: #dc2626; box-shadow: 0 0 0 2px rgb(220 38 38 / 15%); }

/* ================= DASHBOARD ĐIỀU HÀNH (/dashboard) ================= */
.db-root:fullscreen { overflow: auto; padding: 20px 24px; background: var(--app-bg, #f7f4ef); }
.db-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.db-kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 16px; border: 1px solid #d5dbe3; border-radius: 10px; background: #fff; }
.db-kpi__label { font-size: .8rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted, #475569); }
.db-kpi__value { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--ink, #0f172a); }
.db-kpi__chu { display: block; font-size: 1.25rem; line-height: 1.25; }
.db-kpi__value small { font-size: 1.05rem; font-weight: 600; color: var(--muted, #475569); }
.db-kpi__sub { font-size: .82rem; line-height: 1.45; color: var(--muted, #475569); }
.db-kpi__sub strong { color: var(--ink, #0f172a); }
.db-key { display: inline-flex; align-items: center; gap: 5px; }
.db-key::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.db-meter { height: 8px; border-radius: 999px; background: #e8e7e2; overflow: hidden; }
.db-meter i { display: block; height: 100%; border-radius: 999px; background: #2a78d6; transition: width .4s ease; }

.db-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: start; }
.db-c5 { grid-column: span 5; } .db-c6 { grid-column: span 6; } .db-c7 { grid-column: span 7; }
.db-panel { margin: 0; min-width: 0; }
.db-panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.db-panel__head h2 { margin-bottom: 6px; font-size: 1.02rem; }
.db-note { margin: 0 0 10px; }
.db-dem { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted, #475569); white-space: nowrap; }
.db-trong { margin: 18px 0; text-align: center; }
.db-svg { width: 100%; height: auto; display: block; }
.db-svg__so { font-size: 13px; font-weight: 700; fill: #0b0b0b; }
.db-axis { stroke: #c3c2b7; stroke-width: 1; }
.db-doc { stroke: #52514e; stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.db-doc-diem { pointer-events: none; }
.db-bang { margin-top: 10px; font-size: .85rem; }
.db-bang summary { cursor: pointer; color: var(--muted, #475569); }
.db-bang .table-wrap { max-height: 280px; overflow: auto; margin-top: 8px; }

/* Danh sách thanh đo: tên | thanh | số, dòng phụ bên dưới */
.db-ml { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; }
.db-ml__row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(80px, 1fr) auto; grid-template-areas: "ten bar so" "phu phu phu"; gap: 2px 12px; align-items: center; padding: 7px 4px; border-bottom: 1px solid #eef0f3; }
.db-ml__row:hover { background: #f8fafc; }
.db-ml__ten { grid-area: ten; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.db-ml__row .db-meter { grid-area: bar; }
.db-ml__so { grid-area: so; min-width: 52px; text-align: right; font-size: .86rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.db-ml__phu { grid-area: phu; font-size: .76rem; color: var(--muted, #475569); }
.db-canh { color: #92400e; font-weight: 600; }

/* Điều chỉnh khi thẩm định: thanh phân kỳ quanh trục 0 */
.db-dv__tom { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; font-size: .85rem; }
.db-dv__tom i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; vertical-align: -1px; }
.db-dvl { list-style: none; margin: 0; padding: 0; }
.db-dv { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr); gap: 10px; align-items: center; padding: 4px; border-bottom: 1px solid #f1f2f4; }
.db-dv__ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.db-dv__truc { position: relative; height: 22px; }
.db-dv__truc::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 1px solid #898781; }
.db-dv__truc i { position: absolute; top: 5px; height: 12px; }
.db-dv__truc i.is-am { right: 50%; border-radius: 4px 0 0 4px; }
.db-dv__truc i.is-duong { left: 50%; border-radius: 0 4px 4px 0; }
.db-dv__truc b { position: absolute; top: 2px; font-size: .78rem; font-weight: 700; color: #0b0b0b; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Dự kiến xếp loại: thanh phân đoạn */
.db-xl { display: grid; gap: 14px; margin: 6px 0 10px; }
.db-xl__ten { margin-bottom: 4px; font-size: .86rem; font-weight: 600; color: var(--ink-2, #1e293b); }
.db-xl__thanh { display: flex; gap: 2px; height: 34px; }
.db-xl__thanh span { display: flex; align-items: center; justify-content: center; min-width: 3px; font-size: .85rem; font-weight: 700; }
.db-xl__thanh span:first-child { border-radius: 6px 0 0 6px; }
.db-xl__thanh span:last-child { border-radius: 0 6px 6px 0; }
.db-xl__thanh span:only-child { border-radius: 6px; }

/* Hoạt động trực tiếp */
.db-feed { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
.db-feed__item { display: grid; grid-template-columns: 42px 10px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 7px 4px; border-bottom: 1px solid #eef0f3; font-size: .86rem; }
.db-feed__item a { color: var(--ink, #0f172a); }
.db-feed__tg { font-variant-numeric: tabular-nums; color: var(--muted, #475569); font-size: .8rem; }
.db-feed__dot { width: 8px; height: 8px; border-radius: 50%; background: #2a78d6; }
.db-feed__item--thamdinh .db-feed__dot { background: #eb6834; }
.db-feed__item--nop .db-feed__dot { background: #0ca30c; box-shadow: 0 0 0 3px rgb(12 163 12 / 18%); }
.db-feed__item--molai .db-feed__dot { background: #fab219; }
.db-feed__item--minhchung .db-feed__dot { background: #c3c2b7; }
.db-feed__item--nop a, .db-feed__item--molai a { font-weight: 600; }
.db-feed__item.is-new { animation: db-moi 2.4s ease-out; }
@keyframes db-moi { from { background: #fff4d6; } to { background: transparent; } }

@media (max-width: 1280px) { .db-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .db-c5, .db-c6, .db-c7 { grid-column: 1 / -1; } }
@media (max-width: 640px) { .db-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .db-kpi__value { font-size: 1.6rem; } }
@media print { .db-ml, .db-feed { max-height: none; } .db-bang { display: none; } }

/* Thiết lập: kiểu tệp được tải lên */
.kt-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 14px; }
.kt-nhom { margin: 0; padding: 10px 14px 12px; border: 1px solid #d5dbe3; border-radius: 10px; background: #fff; }
.kt-nhom legend { padding: 0 6px; font-weight: 700; }
.kt-toida { max-width: 640px; margin-bottom: 14px; }
.kt-toida .input { width: 140px; }
.kt-opt { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-bottom: 1px solid #f1f2f4; cursor: pointer; }
.kt-opt:last-of-type { border-bottom: 0; }
.kt-opt input { margin-top: 3px; }
.kt-opt code { margin-left: 4px; font-size: .78rem; color: var(--muted, #475569); }
.kt-opt .muted { display: block; }
@media (max-width: 900px) { .kt-cols { grid-template-columns: 1fr; } }

/* ============================================================
   SAO LƯU DỮ LIỆU
   ============================================================ */
.sl-running { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 14px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1e3a8a; font-size: .92rem; }
.spinner--sm { width: 18px; height: 18px; margin: 0; border-width: 3px; flex: none; }
.sl-stats .stat__value { font-size: 1.25rem; }
.stat--bad { border-left-color: #dc2626; }
.stat--bad .stat__value { color: #dc2626; }
.sl-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
.sl-grid > .panel { min-width: 0; }
@media (max-width: 1000px) { .sl-grid { grid-template-columns: 1fr; } }
.sl-cd { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.sl-cd li { position: relative; padding: 8px 10px 8px 34px; border-radius: 6px; font-size: .9rem; line-height: 1.45; background: #f9fafb; }
.sl-cd li::before { position: absolute; left: 10px; top: 8px; width: 16px; height: 16px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.sl-cd--ok { background: #f0fdf4 !important; color: #14532d; }
.sl-cd--ok::before { content: "✓"; background: #15803d; }
.sl-cd--info { background: #eff6ff !important; color: #1e3a8a; }
.sl-cd--info::before { content: "i"; background: #2563eb; }
.sl-cd--canh-bao { background: #fffbeb !important; color: #78350f; }
.sl-cd--canh-bao::before { content: "!"; background: #d97706; }
.sl-cd--loi { background: #fef2f2 !important; color: #7f1d1d; }
.sl-cd--loi::before { content: "×"; background: #dc2626; }
.sl-ngay .btn { margin-top: 4px; }
.sl-kieu { margin: 0 0 12px; padding: 0; border: 0; display: grid; gap: 8px; }
.sl-kieu__opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 8px; cursor: pointer; }
.sl-kieu__opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft, #fdf2f2); }
.sl-kieu__opt input { margin-top: 4px; accent-color: var(--brand); }
.sl-kieu__opt > span { display: grid; gap: 1px; }
.sl-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.sl-head .check-line { margin: 0; }
.sl-table td { vertical-align: top; }
.sl-table .num { text-align: right; }
.sl-ghichu { min-width: 220px; max-width: 420px; }
.sl-path { margin-top: 2px; font-family: ui-monospace, Consolas, monospace; font-size: .74rem; overflow-wrap: anywhere; }
.sl-daxoa td { color: #9ca3af; }
.sl-boqua td { color: #6b7280; }
.sl-table form { display: inline; }
.sl-xoa { color: #b91c1c; }
.sl-loai { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.sl-loai--DayDu { background: #0d366b; color: #fff; }
.sl-loai--ViSai { background: #dbeafe; color: #184f95; }
.sl-loai--BanSao { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.sl-tt { font-weight: 600; font-size: .86rem; }
.sl-tt--ok { color: #15803d; }
.sl-tt--loi { color: #dc2626; }
.sl-tt--bo { color: #6b7280; font-weight: 500; }
.sl-tt--chay { color: #2563eb; }
.sl-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin-bottom: 16px; }
@media (max-width: 1000px) { .sl-opts { grid-template-columns: 1fr; } }
.sl-nhom { margin: 0; padding: 12px 16px 4px; border: 1px solid #e5e7eb; border-radius: 8px; min-width: 0; }
.sl-nhom legend { padding: 0 6px; font-weight: 700; color: var(--brand); }
.sl-hd summary { cursor: pointer; }
.sl-hd ul { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.sl-modal { max-width: 860px; }
.sl-modal .seg { margin-bottom: 10px; }
.sl-lenh { max-height: 50vh; overflow: auto; margin: 0 0 16px; padding: 12px; border-radius: 6px; background: #0f172a; color: #e2e8f0; font: .78rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre; }
.sl-canh { margin: 0 0 10px !important; padding: 8px 10px; border-radius: 6px; background: #fef2f2; color: #991b1b !important; font-size: .86rem; }

/* ============================================================
   HẠ TẦNG - DUNG LƯỢNG
   ============================================================ */
.ht-stats .stat__value { font-size: 1.25rem; }
.stat--warn { border-left-color: #d97706; }
.stat--warn .stat__value { color: #b45309; }
.ht-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ht-grid > .panel { min-width: 0; }
@media (max-width: 1280px) { .ht-grid { grid-template-columns: 1fr; } }
.ht-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.ht-head h2 { margin: 0; }
.ht-head .seg__btn { text-decoration: none; }
.ht-sel-dv { max-width: 320px; }
.ht-stack { display: flex; gap: 2px; height: 22px; margin: 4px 0 14px; border-radius: 4px; overflow: hidden; background: #f3f4f6; }
.ht-stack i { display: block; min-width: 3px; }
.ht-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; vertical-align: -1px; }
.ht-table { font-size: .88rem; }
.ht-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ht-table td { vertical-align: top; }
.ht-tong td { font-weight: 700; background: #f9fafb; }
.ht-zero td { color: #9ca3af; }
.ht-ten { min-width: 220px; }
.ht-bar { display: inline-block; width: 90px; height: 8px; margin-right: 6px; border-radius: 4px; background: #eef2f7; vertical-align: 1px; overflow: hidden; }
.ht-bar i { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: #2a78d6; }
.ht-zero .ht-bar i { background: transparent; }
.ht-cols { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-bottom: 2px; border-bottom: 1px solid #d1d5db; }
.ht-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.ht-col i { display: block; width: 100%; min-height: 1px; border-radius: 3px 3px 0 0; background: #2a78d6; }
.ht-col:hover i { background: #1c5cab; }
.ht-cols__truc { display: flex; justify-content: space-between; margin: 4px 0 10px; }
/* Tải lên theo ngày: khoảng ngày theo mốc kỳ, dải giai đoạn, vạch hôm nay */
.ht-ngay { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .9rem; }
.ht-ngay label { display: inline-flex; align-items: center; gap: 6px; }
.ht-bd { position: relative; }
.ht-cols--day { gap: 1px; }
.ht-cols--day .ht-col i { border-radius: 1px 1px 0 0; }
.ht-col.is-sau i { background: #e5e7eb; }
.ht-homnay { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed #dc2626; pointer-events: none; }
.ht-gd { position: relative; height: 22px; margin-top: 4px; }
.ht-gd i { position: absolute; top: 0; height: 100%; border-radius: 4px; opacity: .85; overflow: hidden; color: #fff; font-style: normal; font-size: .72rem; line-height: 22px; white-space: nowrap; }
.ht-gd i span { padding: 0 6px; }
.ht-nhan { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #dcfce7; color: #166534; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.ht-canh { margin: 12px 0 0; padding: 8px 12px; border-radius: 6px; background: #fffbeb; color: #78350f; font-size: .88rem; }
.ht-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; font-size: .9rem; }
.ht-dl dt { color: #6b7280; }
.ht-dl dd { margin: 0; min-width: 0; }
.ht-path { overflow-wrap: anywhere; font-size: .78rem; }
.ht-h3 { margin: 14px 0 6px; font-size: .95rem; }
.ht-disk { height: 14px; border-radius: 7px; background: #eef2f7; overflow: hidden; }
.ht-disk i { display: block; height: 100%; background: #2a78d6; }
.ht-disk.is-warn i { background: #d97706; }
.ht-disk.is-bad i { background: #dc2626; }
.ht-list { margin: 6px 0; padding-left: 18px; }
th.ht-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.ht-sortable::after { content: " ↕"; color: #c0c6cf; font-size: .8em; }
th.ht-sortable[aria-sort="descending"]::after { content: " ↓"; color: var(--brand); }
th.ht-sortable[aria-sort="ascending"]::after { content: " ↑"; color: var(--brand); }

/* Nhiều chỉ tiêu tỷ lệ: mỗi chỉ tiêu thành phần một dòng (tên | kế hoạch | đạt được | không giao) */
.cd-ct { flex: 1 1 100%; display: grid; gap: 4px; margin-bottom: 6px; }
.cd-ct__head, .cd-ct__row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 110px 96px; gap: 6px 10px; align-items: center; }
.cd-ct__head { font-size: .74rem; color: #6b7280; text-transform: uppercase; letter-spacing: .02em; }
.cd-ct__row { padding: 4px 0; border-top: 1px dashed #e5e7eb; }
.cd-ct__ten { font-size: .86rem; line-height: 1.35; }
.cd-ct .field { margin: 0; min-width: 0; }
.cd-ct .check-line { margin: 0; }
.cd-ct__row:has([name="CtKhongGiao"]:checked) .cd-ct__ten { color: #9ca3af; text-decoration: line-through; }
@media (max-width: 640px) {
  .cd-ct__head { display: none; }
  .cd-ct__row { grid-template-columns: 1fr 1fr; }
  .cd-ct__ten { grid-column: 1 / -1; }
}
.thu-ct { display: grid; grid-template-columns: minmax(0, 1fr) 110px 110px auto; gap: 8px; align-items: end; width: 100%; }
.thu-ct__ten { font-size: .86rem; align-self: center; }

/* Nút "Xuất…" xổ xuống chọn Excel / Word / PDF */
.xuat-menu { position: relative; display: inline-block; }
.xuat-menu > summary { list-style: none; cursor: pointer; }
.xuat-menu > summary::-webkit-details-marker { display: none; }
.xuat-menu__mui { font-size: .8em; margin-left: 2px; opacity: .7; }
.xuat-menu__ds { position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 250px; padding: 6px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 10px; box-shadow: 0 10px 28px rgba(15, 23, 42, .16); }
.xuat-menu__ds a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.xuat-menu__ds a:hover, .xuat-menu__ds a:focus-visible { background: var(--surface-2, #f3f4f6); }
.xuat-menu__ds strong { display: block; font-size: .92rem; }
.xuat-menu__ds small { display: block; color: var(--muted, #64748b); font-size: .78rem; }
.xuat-menu__ic { flex: 0 0 auto; width: 34px; padding: 3px 0; border-radius: 5px; color: #fff; font: 700 .68rem/1.2 system-ui, sans-serif; text-align: center; }
.xuat-menu__ic--x { background: #1d6f42; }
.xuat-menu__ic--w { background: #2b579a; }
.xuat-menu__ic--p { background: #b30b00; }

/* ---- Bộ lọc danh sách đơn vị (Theo dõi tiến độ / Thẩm định) ---- */
.loc-ds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 14px 0 12px; }
.loc-ds .input { width: auto; min-width: 170px; }
.loc-ds .loc-ds__ten { flex: 1 1 240px; max-width: 380px; }
.loc-ds__ghichu { flex-basis: 100%; }
@media (max-width: 640px) { .loc-ds .input, .loc-ds .loc-ds__ten { flex: 1 1 100%; max-width: none; } }

/* ---- Thẩm định: đối chiếu song song với tự chấm ---- */
.cd-cols--2 > .cd-block { border: 1px solid #e5e7eb; }
.cd-cols--2 > .cd-block:not(.cd-block--td) { border-top: 3px solid #94a3b8; }
.cd-cols--2 > .cd-block--td { border-color: #bbf7d0; border-top: 3px solid #16a34a; }
.cd-block--td .cd-block__title { color: #166534; }
.cd-td-khoa { margin: 4px 0 8px; padding: 6px 10px; border-radius: 6px; background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
/* Danh sách thẩm định: cột "Phần của tôi" + màu nút theo phần của mình */
.progress-bar--toi > span { background: #2563eb; }
.td-toi--du .progress-bar--toi > span { background: #16a34a; }
.td-toi--du strong { color: #15803d; } .td-toi--dang strong { color: #b45309; } .td-toi--chua strong { color: #b91c1c; }
.btn-td--chua { background: #c8102e; border-color: #c8102e; color: #fff; }
.btn-td--chua:hover:not(:disabled) { background: #a50d26; color: #fff; }
.btn-td--dang { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-td--dang:hover:not(:disabled) { background: #d97706; color: #fff; }
.btn-td--xong { background: #dcfce7; border-color: #16a34a; color: #15803d; }
.btn-td--xong:hover:not(:disabled) { background: #bbf7d0; color: #166534; }
.btn-td--khong { background: transparent; border-color: #cbd5e1; color: #64748b; }
/* Tài khoản hỗ trợ đang thao tác trên tiêu chí đã giao người khác */
.cd-td-hotro { margin: 4px 0 8px; padding: 6px 10px; border-radius: 6px; background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.cd-chenh { margin-top: 6px; padding: 5px 10px; border-radius: 6px; font-size: .85rem; font-weight: 600; }
.cd-chenh.is-giu { background: #ecfdf5; color: #047857; }
.cd-chenh.is-doi { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.cd-block--td input.is-khac-tc { border-color: #f59e0b; background: #fffbeb; box-shadow: 0 0 0 2px rgb(245 158 11 / 18%); }
.cd-block--td label.is-khac-tc { color: #b45309; font-weight: 600; }

/* ---- Theo dõi thẩm định (dashboard) ---- */
.td-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 14px 0; }
.td-kpi__card { padding: 14px 16px; border: 1px solid var(--line, #e5e7eb); border-left: 4px solid var(--brand); border-radius: 10px; background: #fff; }
.td-kpi__card--chinh { border-left-color: #16a34a; }
.td-kpi__nhan { font-size: .8rem; font-weight: 700; text-transform: uppercase; color: #6b7280; }
.td-kpi__so { margin: 4px 0; font-size: 1.9rem; font-weight: 800; line-height: 1.1; color: var(--ink, #111827); }
.td-kpi__so small { font-size: 1rem; font-weight: 600; color: #6b7280; }
.td-kpi__chia { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; font-weight: 600; }
.td-kpi .is-ok { color: #15803d; } .td-kpi .is-dang { color: #b45309; } .td-kpi .is-chua { color: #6b7280; }
.is-tang { color: #15803d; } .is-giam { color: #b91c1c; }
.td-2cot { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
/* Thống kê thẩm định: biểu đồ, tiêu chí còn thiếu, đơn vị chưa nộp */
.td-bd { display: flex; justify-content: center; align-items: center; min-height: 180px; }
.td-bd > div { width: 100%; }
.td-bd .donut { justify-content: center; }
tr[data-tc].is-chua td:first-child { box-shadow: inset 3px 0 0 #dc2626; }
.td-thieu { color: #b91c1c; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.td-chuanop summary { cursor: pointer; }
.td-chuanop__ds { columns: 3 220px; margin: 10px 0 0; padding-left: 22px; }
.td-chuanop__ds li { break-inside: avoid; padding: 1px 0; }
@media (max-width: 1100px) { .td-2cot { grid-template-columns: 1fr; } }
.td-h2 { margin: 0 0 10px; font-size: 1.05rem; }
.td-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.td-bar__dau { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.td-bar__so { white-space: nowrap; color: #374151; }
.td-bar.is-xong .td-bar__so b { color: #15803d; }
.td-bar.is-chua .td-bar__so b { color: #b91c1c; }
.td-ten2 { font-size: .88rem; }
.td-dv td { vertical-align: top; }
.xl-chip.is-doi { outline: 2px solid #f59e0b; outline-offset: 1px; }
#td-theodoi table[data-sort-table] th[data-sort] { cursor: pointer; user-select: none; }
#td-theodoi table[data-sort-table] th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
#td-theodoi table[data-sort-table] th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }

/* ---- Tài liệu căn cứ thẩm định + ý kiến bắt buộc ---- */
.cd-mc--td .cd-mc__nut { border-color: #bbf7d0; background: #fff; }
.cd-mc--td .cd-mc__chu { color: #166534; }
.cd-files__ghi { margin: 0 0 8px; }
.cd-gt__bb { margin-left: 4px; font-size: .72rem; font-weight: 700; color: #b91c1c; text-transform: none; }
.cd-block textarea.is-can-yk { border-color: #dc2626; background: #fef2f2; box-shadow: 0 0 0 2px rgb(220 38 38 / 15%); }
.td-kpi__card--canh { border-left-color: #dc2626; background: #fffafa; }

/* ---- Trang lỗi: gợi ý + chi tiết kỹ thuật cho quản trị ---- */
.errpage__goiy { max-width: 720px; margin: 8px auto; padding: 10px 14px; border-radius: 8px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; text-align: left; }
.errpage__ct { max-width: 900px; margin: 10px auto 16px; text-align: left; }
.errpage__ct pre { white-space: pre-wrap; word-break: break-word; padding: 10px 12px; border-radius: 8px; background: #111827; color: #e5e7eb; font-size: .8rem; }
.errpage:has(.errpage__ct), .errpage:has(.errpage__goiy) { max-width: 960px; }
.csdl-canh { margin: 0 0 14px; padding: 12px 16px; border-radius: 10px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-size: .9rem; line-height: 1.5; }

/* ---------- Bảo trì (cập nhật phần mềm): dải đếm ngược, hộp thông báo, trang quản trị ---------- */
.bt-dai { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 10px 16px;
    border-radius: 10px; font-size: .92rem; line-height: 1.45; box-shadow: 0 2px 8px rgb(15 23 42 / 12%); }
.bt-dai--do { background: #b91c1c; color: #fff; }
.bt-dai--xanh { background: #15803d; color: #fff; }
.bt-dai__chu { flex: 1; min-width: 0; }
.bt-dai__nd { margin-top: 2px; font-size: .85rem; opacity: .92; }
.bt-dai .btn { flex: none; background: #fff; color: #15803d; border-color: #fff; }
dialog .bt-dai { position: static; margin: 0; border-radius: 0; box-shadow: none; }
.bt-hop { max-width: 520px; width: calc(100% - 32px); padding: 20px 22px; border: 0; border-top: 6px solid #b91c1c; border-radius: 12px; }
.bt-hop::backdrop { background: rgb(17 24 39 / 55%); }
.bt-hop h2 { margin: 0 0 10px; font-size: 1.1rem; color: #b91c1c; }
.bt-hop__nd { white-space: pre-line; line-height: 1.55; }
.bt-hop__gio { padding: 8px 12px; border-radius: 8px; background: #fef2f2; color: #991b1b; font-weight: 600; font-size: .9rem; }
.bt-hop__nut { display: flex; justify-content: flex-end; margin-top: 14px; }
.is-bao-tri .cd-upload, .is-bao-tri .js-mc-mo ~ .cd-upload { opacity: .5; pointer-events: none; }
.bt-tt { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.bt-tt--ok { background: #dcfce7; color: #166534; }
.bt-tt--warn { background: #fef3c7; color: #92400e; }
.bt-tt--danger { background: #fee2e2; color: #991b1b; }
.bt-noidung { margin: 6px 0 12px; padding: 10px 14px; border-left: 4px solid #b91c1c; background: #fef2f2; white-space: pre-line; }
.bt-buoc li { margin-bottom: 6px; line-height: 1.5; }

/* Ô mật khẩu có nút "con mắt" (ui.js gắn tự động) */
.mk-o { position: relative; display: block; }
.mk-o > .input { width: 100%; padding-right: 42px; }
.mk-mat { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: #64748b; cursor: pointer; }
.mk-mat:hover { background: #f1f5f9; color: #1e293b; }
.mk-mat:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }
.mk-mat[aria-pressed="true"] { color: #c8102e; }
/* Edge/IE có sẵn nút con mắt riêng → ẩn để không bị hai nút */
input[type=password]::-ms-reveal, input[type=password]::-ms-clear { display: none; }

/* ============================================================
   GỌN TRANG (dùng chung): bảng cuộn trong khung + tiêu đề cột cố định, lọc nhanh, thẻ (tab), panel gọn
   ============================================================ */
.table-wrap--cuon { max-height: var(--cao-bang, min(64vh, 680px)); overflow: auto; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; }
.table-wrap--cuon > .table > thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 #d1d5db; }
.table-wrap--cuon > .table > tbody > tr.table__group > td { position: sticky; top: 42px; z-index: 1; }
.table-wrap--thap { --cao-bang: min(42vh, 420px); }
.is-tim-an { display: none !important; }
.tim-bang { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.tim-bang .input { width: min(360px, 100%); }
.panel--gon { padding: 12px 14px; }
.panel--gon .td-h2 { margin: 0 0 8px; }
.ds-cuon { max-height: var(--cao-ds, 300px); overflow: auto; padding-right: 4px; }
/* Thẻ (tab) */
.the { padding: 0; overflow: hidden; }
.the__nut { display: flex; gap: 2px; flex-wrap: wrap; padding: 6px 8px 0; border-bottom: 1px solid var(--line, #e5e7eb); background: #f8fafc; }
.the__nut button { border: 0; background: transparent; padding: 9px 14px; font: inherit; font-weight: 600; color: #475569; cursor: pointer; border-radius: 8px 8px 0 0; border-bottom: 3px solid transparent; }
.the__nut button:hover { color: #0f172a; background: #eef2f7; }
.the__nut button.is-on { color: var(--brand, #c8102e); background: #fff; border-bottom-color: var(--brand, #c8102e); }
.the__so { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #e2e8f0; color: #334155; font-size: .78rem; text-align: center; }
.the__nut button.is-on .the__so { background: #fde2e6; color: #9f1239; }
.the__so--canh { background: #fee2e2 !important; color: #b91c1c !important; }
.the__o { padding: 12px 14px 14px; }
.the__o > .loc-ds { margin-top: 0; }
/* Dashboard thẩm định: thẻ số liệu gọn, 3 cột biểu đồ */
.td-kpi--gon { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 10px 0; }
.td-kpi--gon .td-kpi__card { padding: 10px 12px; }
.td-kpi--gon .td-kpi__so { font-size: 1.55rem; }
.td-kpi--gon .td-kpi__nhan { font-size: .72rem; }
.td-3cot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; margin-bottom: 12px; }
.td-3cot > .panel { margin: 0; }
@media (max-width: 1200px) { .td-3cot { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .td-3cot { grid-template-columns: 1fr; } }
.td-3cot .td-bd { min-height: 160px; }
.td-3cot .td-bars { margin: 0; }

.cd-sum__toi { margin-top: 4px; padding: 4px 8px; border-radius: 6px; background: #ecfdf5; color: #065f46; }

/* Mục cha khi thẩm định: điểm phần của cơ quan + điểm toàn mục + số tiêu chí cơ quan khác đang ẩn */
.cd-td--muc { opacity: .75; font-weight: 600; }
.cd-sec__an { flex-basis: 100%; margin: 2px 0 0 34px; font-size: .78rem; font-weight: 600; color: #64748b; font-style: italic; }

/* Chuông: âm báo đang bị trình duyệt chặn (chưa bấm vào trang) → chấm cam nhỏ ở góc */
.bell.is-cam .bell__btn { position: relative; }
.bell.is-cam .bell__btn::after { content: ""; position: absolute; left: 4px; bottom: 4px; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 2px #fff; }

/* ---- Rà soát kết quả ---- */
.rs-cb { color: #b45309; line-height: 1.35; }
.rs-cb--nhe { color: #64748b; }
.rs-moi { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rs-moi li { padding: 6px 8px; border-left: 3px solid #f59e0b; background: #fffbeb; border-radius: 6px; }
.rs-tt { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.rs-tt--1 { background: #fee2e2; color: #b91c1c; }
.rs-tt--2 { background: #fef3c7; color: #92400e; }
.rs-tt--3 { background: #dcfce7; color: #166534; }
.rs-hd ol { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; }
.status--info { background: #dbeafe; color: #1e40af; }
.status--warn { background: #fef3c7; color: #92400e; }
.status--danger { background: #fee2e2; color: #b91c1c; }
/* Khối rà soát trong hồ sơ */
.rs-khoi { margin-top: 8px; padding: 8px 10px; border: 1px dashed #c7d2fe; border-radius: 8px; background: #f8faff; }
.rs-khoi__tieu { font-size: .8rem; font-weight: 800; text-transform: uppercase; color: #3730a3; margin-bottom: 4px; }
.rs-yk { padding: 6px 8px; margin: 4px 0; border-radius: 6px; background: #fff; border: 1px solid #e2e8f0; font-size: .88rem; }
.rs-yk--1 { border-left: 3px solid #dc2626; } .rs-yk--2 { border-left: 3px solid #f59e0b; } .rs-yk--3 { border-left: 3px solid #16a34a; opacity: .85; }
.rs-yk__ph { margin-top: 4px; padding: 4px 8px; background: #fffbeb; border-radius: 4px; }
.rs-yk__nut { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rs-form { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; }
.rs-form textarea { flex: 1; min-height: 38px; }
.rs-chot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 14px; margin: 0 0 12px; border-radius: 10px; border: 1px solid #c7d2fe; background: #eef2ff; }
.rs-chot.is-chot { border-color: #86efac; background: #f0fdf4; }
.rs-chot__tt { font-weight: 700; }
.rs-chot details summary { cursor: pointer; }
.rs-dem { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.loc-rs .cd-leaf:not([data-rs="1"]) { display: none; }
.loc-rs .cd-sec:not(:has(.cd-leaf[data-rs="1"])) { display: none; }
.rs-nhac { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.rs-nhac__ma { display: inline-block; margin: 0 4px; padding: 0 6px; border-radius: 4px; background: #ffedd5; font-weight: 700; color: #9a3412; }
.rs-chung { flex-basis: 100%; }
.rs-chung > summary { list-style: none; }
.cd-sec__head:has(.cd-sec__an) { flex-wrap: wrap; }
/* Nút lên đầu trang (phía trên nút Trợ lý) */
.len-dau { position: fixed; right: 26px; bottom: 76px; z-index: 890; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: #1e293b; color: #fff; box-shadow: 0 4px 14px rgb(15 23 42 / 30%); cursor: pointer; opacity: .85; }
.len-dau:hover { opacity: 1; background: var(--brand, #c8102e); }
.len-dau:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
@media print { .len-dau { display: none !important; } }
/* Chuyển đơn vị trước / tiếp theo */
.cd-chuyen { display: inline-flex; align-items: center; gap: 6px; }
.cd-chuyen .is-disabled { opacity: .45; pointer-events: none; }
.cd-chuyen__vt { min-width: 44px; text-align: center; }
/* Cột TT tự đánh số (đếm lại theo dòng đang hiện: lọc, sắp xếp vẫn đúng) */
table.co-tt > tbody { counter-reset: tt; }
table.co-tt > tbody > tr > td.col-tt::before { counter-increment: tt; content: counter(tt); }
.col-tt { width: 42px; text-align: center !important; color: #64748b; font-variant-numeric: tabular-nums; }

/* Nhãn "Không phát sinh": ghi rõ cách tính của tiêu chí */
.cd-kps { margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.cd-kps--dat { background: #dcfce7; color: #166534; }
.cd-kps--tru { background: #e0e7ff; color: #3730a3; }
