/* thongtin.forfuture.vn — giao diện theo hệ CRM (crm.forfuture.vn là chuẩn app nội bộ): thanh trên xanh #0b6ef2,
   thẻ trắng bo 14px bóng mềm, nút bo 10px, một màu nhấn xanh dương. */
:root {
  --primary: #0b6ef2;
  --primary-600: #0a5fd1;
  --primary-soft: #e8f1fe;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --violet: #6d28d9;
  --violet-soft: #f3efff;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.18);
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- thanh trên */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.brand-sub {
  font-size: 12px;
  opacity: 0.8;
  white-space: nowrap;
}
.brand-sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.3);
}
.top-spacer {
  flex: 1;
}
.top-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.top-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 4px 6px;
  border-radius: 10px;
  max-width: 280px;
}
.user-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #fff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-meta {
  text-align: left;
  min-width: 0;
  line-height: 1.2;
}
.user-meta b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta small {
  font-size: 11.5px;
  opacity: 0.85;
  white-space: nowrap;
}
.menu {
  position: absolute;
  right: 16px;
  top: 52px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 6px;
  z-index: 40;
}
.menu a,
.menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 0;
  background: none;
  text-decoration: none;
  color: var(--ink);
  font-size: 13.5px;
  text-align: left;
}
.menu a:hover,
.menu button:hover {
  background: var(--bg);
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}
.menu .danger {
  color: var(--bad);
}

/* ---------------------------------------------------------------- khung trang */
.page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-head h1 {
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.page-head p {
  margin: 0;
  color: var(--muted);
}
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--primary-soft);
  border: 1px solid #c7dcfc;
  color: #0b3f8a;
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
}
.notice svg {
  flex: none;
  margin-top: 2px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- thẻ số liệu */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: grid;
  gap: 2px;
  position: relative;
}
.kpi:hover {
  border-color: var(--line-2);
}
.kpi[aria-pressed="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow);
}
.kpi-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  color: var(--muted);
  font-size: 12px;
}
.bar {
  height: 6px;
  border-radius: 99px;
  background: #edf1f7;
  overflow: hidden;
  margin-top: 6px;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--ok);
}

/* ---------------------------------------------------------------- thanh lọc + bảng */
.panel {
  overflow: hidden;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.search input {
  padding-left: 34px;
}
.input,
.select,
textarea.input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: var(--radius);
  padding: 0 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input {
  height: auto;
  min-height: 76px;
  padding: 8px 11px;
  resize: vertical;
  line-height: 1.45;
}
.input:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.select {
  padding-right: 28px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.toolbar .select {
  width: auto;
  max-width: 220px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13.5px;
  white-space: nowrap;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: #fff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}
.btn:hover {
  background: var(--bg);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-600);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
}
.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
}
.btn-danger {
  color: var(--bad);
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.chips-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin-right: 2px;
}
.chip {
  height: 28px;
  padding: 0 10px;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}
.chip b {
  font-variant-numeric: tabular-nums;
  color: var(--bad);
}
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chip[aria-pressed="true"] b {
  color: #fff;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  white-space: nowrap;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: top;
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover td {
  background: #f8fafd;
}
tbody tr.is-open td {
  background: var(--primary-soft);
}
.num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 44px;
}
.who b {
  display: block;
  font-weight: 650;
}
td.who {
  min-width: 190px;
}
td.c-course {
  min-width: 180px;
}
.sub {
  color: var(--muted);
  font-size: 12.5px;
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 650;
  background: #eef2f7;
  color: var(--ink-2);
  white-space: nowrap;
}
.tag-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.tag-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.tag-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.tag-blue {
  background: var(--primary-soft);
  color: var(--primary-600);
}
.tag-violet {
  background: var(--violet-soft);
  color: var(--violet);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.course-line {
  display: block;
}
.course-line + .course-line {
  margin-top: 6px;
}
.muted {
  color: var(--muted);
}
.miss-none {
  color: var(--ok);
  font-weight: 650;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}
.pager {
  display: flex;
  gap: 6px;
  align-items: center;
}
.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}
.skeleton td {
  padding: 16px 12px;
}
.skeleton i {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2f7, #f6f8fb, #eef2f7);
  background-size: 200% 100%;
  animation: sk 1.2s infinite linear;
}
@keyframes sk {
  to {
    background-position: -200% 0;
  }
}

/* ---------------------------------------------------------------- đăng nhập / không có quyền */
.gate {
  max-width: 460px;
  margin: 72px auto;
  padding: 28px;
  text-align: center;
}
.gate h1 {
  font-size: 20px;
  margin: 12px 0 6px;
}
.gate p {
  color: var(--muted);
  margin: 0 0 18px;
}
.gate-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin: 0 auto;
}

/* ---------------------------------------------------------------- ngăn kéo điền thông tin */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 50;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(780px, 100%);
  background: var(--bg);
  z-index: 60;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.dw-head {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px 0;
}
.dw-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.dw-title h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}
.dw-title .sub {
  margin-top: 2px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--ink-2);
}
.icon-btn:hover {
  background: var(--bg);
}
.dw-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  flex-wrap: wrap;
}
.dw-progress .bar {
  flex: 1 1 160px;
  margin: 0;
}
.dw-tabs {
  display: flex;
  gap: 2px;
  margin-top: 12px;
  overflow-x: auto;
}
.dw-tab {
  border: 0;
  background: none;
  padding: 10px 12px;
  font-weight: 650;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.dw-tab[aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.dw-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
}
.section {
  padding: 16px;
  margin-bottom: 14px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.section-head h3 {
  margin: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.grid .wide {
  grid-column: 1 / -1;
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.fld {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.fld-label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.fld-lms {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.fld-lms.miss {
  color: var(--warn);
  font-weight: 600;
}
.fld-err {
  font-size: 12px;
  color: var(--bad);
  font-weight: 600;
}
.fld.has-err .input,
.fld.has-err .select {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}
.fld.is-dirty .input,
.fld.is-dirty .select {
  border-color: #f59e0b;
  background: #fffdf5;
}
.fld.is-conflict .input,
.fld.is-conflict .select {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-soft);
}
.dot-sup {
  font-size: 11px;
  font-weight: 650;
  color: var(--ok);
  background: var(--ok-soft);
  border-radius: 99px;
  padding: 0 7px;
  line-height: 18px;
}
.lms-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafd;
  border: 1px dashed var(--line-2);
  margin-bottom: 12px;
  font-size: 13px;
}
.lms-box dt {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 650;
}
.lms-box dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.lms-note {
  grid-column: 1 / -1;
  white-space: pre-wrap;
}
.course-card {
  border-left: 4px solid var(--primary);
}
.course-card.is-new {
  border-left-color: var(--violet);
}
.course-card.is-off {
  border-left-color: var(--line-2);
}
.dw-foot {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dw-status {
  flex: 1;
  min-width: 160px;
  color: var(--muted);
  font-size: 13px;
}
.dw-status.dirty {
  color: var(--warn);
  font-weight: 650;
}
.banner {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13.5px;
}
.banner-violet {
  background: var(--violet-soft);
  color: var(--violet);
  border: 1px solid #ddd3fb;
}
.banner-bad {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid #fbd5d5;
}
.banner-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #fde1c2;
}
.hist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.hist li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.hist li:last-child {
  border-bottom: 0;
}
.hist-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.hist-meta b {
  color: var(--ink);
}
.hist-ch {
  font-size: 13px;
  margin: 2px 0;
  overflow-wrap: anywhere;
}
.hist-ch s {
  color: var(--muted);
}

/* ---------------------------------------------------------------- hộp thoại */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal .scrim {
  z-index: 0;
}
.modal-box {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}
.modal-box h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.dup-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 6px;
}
.dup-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

/* ---------------------------------------------------------------- thông báo nhỏ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  font-weight: 600;
  max-width: calc(100% - 32px);
}
.toast.bad {
  background: var(--bad);
}

/* ---------------------------------------------------------------- màn hẹp */
@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 860px) {
  .brand-sub,
  .brand-sep,
  .user-meta,
  .top-btn span {
    display: none;
  }
  .top {
    padding: 0 12px;
  }
  .page {
    padding: 14px 16px 48px;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .kpi {
    padding: 11px 12px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .toolbar .select {
    flex: 1 1 140px;
    max-width: none;
  }
  .grid,
  .grid-3,
  .lms-box {
    grid-template-columns: minmax(0, 1fr);
  }
  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }
  thead {
    display: none;
  }
  tbody tr {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px 12px;
  }
  td,
  td.who,
  td.c-course {
    padding: 0;
    border: 0;
    min-width: 0;
  }
  tbody tr:hover td,
  tbody tr.is-open td {
    background: none;
  }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
  }
  td.num,
  td.c-action {
    display: none;
  }
  td.who,
  td.c-course,
  td.c-miss {
    grid-column: 1 / -1;
  }
  .dw-head {
    padding: 12px 14px 0;
  }
  .dw-body {
    padding: 12px 12px 20px;
  }
  .dw-foot {
    padding: 10px 12px;
  }
  .dw-foot .btn {
    flex: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  .top,
  .toolbar,
  .chips,
  .foot,
  .notice {
    display: none !important;
  }
}
