/* ============================================================
   AiGara E-learning — giao diện demo
   Bố cục toàn màn hình: sidebar cố định + topbar + vùng nội dung cuộn
   ============================================================ */
:root {
  --brand: #d32130;
  --brand-dark: #a8171f;
  --brand-soft: #fdecec;
  --nav: #0d1626;
  --nav-2: #131f35;
  --nav-line: #22304a;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #8893a4;
  --line: #e4e7ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #12a150;
  --ok-soft: #e8f8ee;
  --warn: #e08b00;
  --warn-soft: #fff5e0;
  --info: #1f6feb;
  --info-soft: #e8f1fe;
  --bad: #d92d20;
  --bad-soft: #fdecec;
  --purple: #7c3aed;
  --purple-soft: #f1ebfe;
  --side-w: 252px;
  --side-w-min: 68px;
  --top-h: 58px;
  --r: 10px;
  --sh: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --sh-lg: 0 8px 28px rgba(16, 24, 40, .14);
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c8cfda; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #a9b3c2; }
::-webkit-scrollbar-track { background: transparent; }

/* Cỡ mặc định cho mọi biểu tượng chèn bằng ic(). Đặt SỚM để các quy tắc riêng
   (.btn svg, .ctrls button svg, .kpi .ki svg…) phía dưới vẫn ghi đè được. */
svg.ic { width: 18px; height: 18px; flex: none; }

/* ---------------- Khung ---------------- */
#shell {
  display: grid; height: 100vh;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: "side top" "side main";
  transition: grid-template-columns .18s ease;
}
#shell.mini { grid-template-columns: var(--side-w-min) minmax(0, 1fr); }

/* ---------------- Sidebar ---------------- */
#side {
  grid-area: side; background: linear-gradient(180deg, var(--nav) 0%, #0a1120 100%);
  color: #cfd8e6; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border-right: 1px solid #0a1120;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; height: var(--top-h);
  flex: none; border-bottom: 1px solid var(--nav-line);
}
.brand .logo {
  width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand) 0%, #f0563f 100%); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 2px 10px rgba(211, 33, 48, .45);
}
.brand .bt { min-width: 0; }
.brand .bt b { display: block; color: #fff; font-size: 14px; letter-spacing: .2px; white-space: nowrap; }
.brand .bt span { display: block; font-size: 11px; color: #7d8ba3; white-space: nowrap; }
#shell.mini .brand .bt { display: none; }

.navwrap { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 0 18px; }
.navwrap::-webkit-scrollbar-thumb { background: #2a3650; border-color: transparent; }
.navgrp { padding: 14px 16px 6px; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #5c6b85; font-weight: 700; }
#shell.mini .navgrp { text-align: center; padding: 12px 4px 4px; font-size: 9px; overflow: hidden; }
.nav {
  display: flex; align-items: center; gap: 11px; padding: 9px 16px; margin: 1px 8px; border-radius: 8px;
  cursor: pointer; color: #b8c4d6; position: relative; white-space: nowrap; min-width: 0;
}
.nav:hover { background: #1a2740; color: #fff; }
.nav.on { background: var(--brand); color: #fff; box-shadow: 0 2px 10px rgba(211, 33, 48, .38); }
.nav .ic { width: 18px; height: 18px; flex: none; opacity: .95; }
.nav .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.nav .cnt {
  flex: none; background: rgba(255, 255, 255, .14); color: #fff; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
}
.nav.on .cnt { background: rgba(0, 0, 0, .22); }
.nav .cnt.hot { background: var(--brand); color: #fff; }
.nav.on .cnt.hot { background: rgba(0, 0, 0, .25); }
#shell.mini .nav { justify-content: center; padding: 10px 0; margin: 1px 10px; }
#shell.mini .nav .lb, #shell.mini .nav .cnt { display: none; }
.sidefoot { flex: none; border-top: 1px solid var(--nav-line); padding: 10px; }
.sidefoot .mini-btn {
  width: 100%; background: #16213a; border: 1px solid var(--nav-line); color: #9fb0c9; border-radius: 8px;
  padding: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px;
}
.sidefoot .mini-btn:hover { background: #1e2c49; color: #fff; }
#shell.mini .sidefoot .mini-btn span { display: none; }

/* ---------------- Topbar ---------------- */
#top {
  grid-area: top; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 18px; min-width: 0; z-index: 20;
}
#top .crumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
#top .crumb h1 { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top .crumb .sub { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.topsearch { flex: 1; max-width: 420px; position: relative; min-width: 0; }
.topsearch input {
  width: 100%; border: 1px solid var(--line); background: #f7f8fa; border-radius: 8px;
  padding: 7px 12px 7px 34px; outline: none;
}
.topsearch input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.topsearch svg { position: absolute; left: 10px; top: 8px; width: 16px; height: 16px; color: var(--ink-3); }
.spacer { flex: 1; }
.ticon {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  display: grid; place-items: center; position: relative; flex: none;
}
.ticon:hover { background: #f5f6f8; }
.ticon .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--brand); border-radius: 50%; border: 2px solid #fff; }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 30px; cursor: pointer; border: 1px solid var(--line); flex: none; }
.who:hover { background: #f5f6f8; }
.who .av { width: 30px; height: 30px; }
.who .wt { line-height: 1.25; min-width: 0; }
.who .wt b { display: block; font-size: 12.5px; white-space: nowrap; }
.who .wt span { display: block; font-size: 11px; color: var(--ink-3); white-space: nowrap; }

.av {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .3px; background: #64748b; overflow: hidden;
}
.av.sm { width: 28px; height: 28px; font-size: 10.5px; }
.av.lg { width: 52px; height: 52px; font-size: 17px; }
.av.xl { width: 72px; height: 72px; font-size: 22px; }

/* ---------------- Vùng nội dung ---------------- */
#main { grid-area: main; overflow-y: auto; overflow-x: hidden; min-width: 0; scroll-behavior: smooth; }
#view { padding: 18px 22px 60px; max-width: 1680px; }
#view.wide { max-width: none; }
#view.flush { padding: 0; max-width: none; }

/* ---------------- Thành phần chung ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); min-width: 0; }
.card.pad { padding: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.card-h h3 { margin: 0; font-size: 14.5px; font-weight: 700; flex: 1; min-width: 0; }
.card-h .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.card-b { padding: 16px; min-width: 0; }
.card-f { padding: 11px 16px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 var(--r) var(--r); }

.grid { display: grid; gap: 16px; min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-3-1 { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
@media (max-width: 1440px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1240px) {
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2, .g-3-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) { .g2, .g3, .g4, .g5 { grid-template-columns: minmax(0, 1fr); } }

.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mt { margin-top: 16px; } .mt-s { margin-top: 10px; } .mb { margin-bottom: 16px; }
.muted { color: var(--ink-3); } .dim { color: var(--ink-2); }
.small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.b { font-weight: 700; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Nút */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  white-space: nowrap; transition: .12s; min-width: 0;
}
.btn:hover { background: #f5f6f8; border-color: #d3d8e0; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.dark { background: var(--nav); border-color: var(--nav); color: #fff; }
.btn.dark:hover { background: #1b2740; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(.93); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #eef0f4; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.xs { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.danger { color: var(--bad); border-color: #f3c2be; background: #fff; }
.btn.danger:hover { background: var(--bad-soft); }

/* Nhãn trạng thái */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; background: #eef0f4; color: var(--ink-2); white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: #0a7a3c; }
.tag.warn { background: var(--warn-soft); color: #a86800; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.info { background: var(--info-soft); color: #1552b5; }
.tag.purple { background: var(--purple-soft); color: #5b21b6; }
.tag.dark { background: #eaecf0; color: #344054; }
.tag.line { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.tag .dt { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Ô số liệu */
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 15px 16px; }
.kpi .kl { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.kpi .kv { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.kpi .kd { font-size: 11.5px; color: var(--ink-3); }
.kpi .ki { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.kpi .ki svg { width: 16px; height: 16px; }

/* Thanh tiến độ */
.bar { height: 7px; border-radius: 20px; background: #eaecf0; overflow: hidden; min-width: 0; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: var(--brand); transition: width .45s ease; }
.bar.sm { height: 5px; }
.bar.lg { height: 10px; }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.info { background: var(--info); }

/* Bảng */
.tbl-wrap { overflow-x: auto; min-width: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
table.tbl tbody tr:hover { background: #fafbfd; }
table.tbl tr.clk { cursor: pointer; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .cellname { display: flex; align-items: center; gap: 9px; min-width: 0; }

/* Ô nhập */
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fld > label .req { color: var(--brand); }
.inp, select.inp, textarea.inp {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: #fff; outline: none;
}
.inp:focus, select.inp:focus, textarea.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.inp { resize: vertical; min-height: 74px; }
select.inp { cursor: pointer; }
.hint { font-size: 11.5px; color: var(--ink-3); }
.chk { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.chk input { margin-top: 3px; accent-color: var(--brand); width: 15px; height: 15px; flex: none; }

/* Thanh lọc */
.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; min-width: 0;
}
.toolbar .grow { flex: 1; min-width: 160px; }
.seg { display: inline-flex; background: #eef0f4; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 13px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
  font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--sh); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; min-width: 0; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 4px 12px; font-size: 12.5px;
  cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: #cbd2dc; }
.chip.on { background: var(--nav); border-color: var(--nav); color: #fff; }

/* Thẻ khoá học */
.ccard { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: .15s; }
.ccard:hover { box-shadow: var(--sh-lg); transform: translateY(-2px); }
.cthumb { height: 122px; position: relative; display: grid; place-items: center; color: #fff; overflow: hidden; flex: none; }
.cthumb .ci { font-size: 34px; opacity: .95; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
.cthumb .cdur {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px;
  padding: 2px 7px; border-radius: 5px; backdrop-filter: blur(2px);
}
.cthumb .cflag { position: absolute; left: 8px; top: 8px; display: flex; gap: 5px; flex-wrap: wrap; max-width: calc(100% - 16px); }
.ccard .cb { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.ccard .ct { font-weight: 700; font-size: 13.8px; line-height: 1.35; }
.ccard .cm { display: flex; gap: 10px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.ccard .cf { padding: 9px 14px; border-top: 1px solid var(--line); background: #fafbfc; }

/* Trình phát bài giảng */
.player-shell { display: grid; grid-template-columns: minmax(0, 1fr) 330px; height: calc(100vh - var(--top-h)); min-width: 0; }
.player-shell.nolist { grid-template-columns: minmax(0, 1fr); }
.player-main { overflow-y: auto; min-width: 0; background: #fff; }
.player-side { border-left: 1px solid var(--line); background: #fafbfc; overflow-y: auto; min-width: 0; }
@media (max-width: 1100px) { .player-shell { grid-template-columns: minmax(0, 1fr); height: auto; } .player-side { border-left: 0; border-top: 1px solid var(--line); } }

.stage { background: #0a0f1a; position: relative; aspect-ratio: 16/9; width: 100%; max-width: 100%; overflow: hidden; }
.slide {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px;
  padding: 6% 8%; color: #fff; opacity: 0; transition: opacity .4s; background: linear-gradient(135deg, #101d36 0%, #1c2f52 100%);
}
.slide.on { opacity: 1; }
.slide .sn { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #8fb4ff; font-weight: 700; }
.slide h2 { margin: 0; font-size: clamp(18px, 2.4vw, 32px); line-height: 1.25; font-weight: 800; }
.slide ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: clamp(12px, 1.25vw, 16px); color: #d6e0f2; }
.slide .cap { position: absolute; left: 0; right: 0; bottom: 58px; text-align: center; padding: 0 10%; }
.slide .cap span { background: rgba(0, 0, 0, .72); color: #fff; padding: 5px 12px; border-radius: 6px; font-size: clamp(11px, 1.1vw, 14px); line-height: 1.7; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.stage .badge-live { position: absolute; left: 14px; top: 12px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 5px; }
.ctrls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .82) 55%); color: #fff;
}
.ctrls .track { height: 5px; background: rgba(255, 255, 255, .28); border-radius: 6px; position: relative; cursor: pointer; margin-bottom: 7px; }
.ctrls .track > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand); border-radius: 6px; }
.ctrls .track .mk { position: absolute; top: -3px; width: 2px; height: 11px; background: rgba(255, 255, 255, .85); border-radius: 2px; }
.ctrls .track .hd { position: absolute; top: -4px; width: 13px; height: 13px; background: #fff; border-radius: 50%; margin-left: -6px; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.ctrls .cr { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }
.ctrls button { background: transparent; border: 0; color: #fff; cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 6px; }
.ctrls button:hover { background: rgba(255, 255, 255, .16); }
.ctrls button svg { width: 19px; height: 19px; }
.ctrls .pp svg { width: 25px; height: 25px; }
.ctrls .sp { border: 1px solid rgba(255, 255, 255, .35); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; }

.lesson-item {
  display: flex; gap: 10px; padding: 9px 13px; cursor: pointer; border-bottom: 1px solid #eef0f3; align-items: flex-start; min-width: 0;
}
.lesson-item:hover { background: #f2f5f9; }
.lesson-item.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.lesson-item .lix { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: #e6e9ef; color: var(--ink-2); margin-top: 1px; }
.lesson-item .lix.done { background: var(--ok); color: #fff; }
.lesson-item .lix.lock { background: #eef0f4; color: #b6bfcc; }
.lesson-item .lt { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; }
.lesson-item .lm { font-size: 11px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.chapter-h { padding: 10px 13px; background: #eff2f6; font-size: 11.5px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid #e3e7ed; position: sticky; top: 0; z-index: 1; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; min-width: 0; }
.tabs button {
  border: 0; background: transparent; padding: 10px 15px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* Hộp thoại */
.mask { position: fixed; inset: 0; background: rgba(16, 24, 40, .55); backdrop-filter: blur(2px); z-index: 200; display: grid; place-items: center; padding: 24px; }
.modal { background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); width: 560px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; min-width: 0; }
.modal.md { width: 760px; } .modal.lg { width: 1000px; } .modal.xl { width: 1280px; } .modal.full { width: 96vw; height: 92vh; }
.modal .mh { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex: none; }
.modal .mh h3 { margin: 0; font-size: 15.5px; flex: 1; min-width: 0; }
.modal .mb { padding: 18px; overflow-y: auto; flex: 1; min-width: 0; }
.modal .mf { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; background: #fafbfc; border-radius: 0 0 12px 12px; flex: none; flex-wrap: wrap; }
.x { width: 30px; height: 30px; border-radius: 7px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--ink-3); }
.x:hover { background: #eef0f4; color: var(--ink); }

/* Thông báo nổi */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 400; pointer-events: none; }
.toast {
  background: var(--nav); color: #fff; padding: 11px 15px; border-radius: 9px; box-shadow: var(--sh-lg); font-size: 13px;
  display: flex; align-items: center; gap: 9px; animation: tin .22s ease; max-width: 380px;
}
.toast.ok { background: #0d7a3f; } .toast.bad { background: var(--bad); } .toast.warn { background: #b26a00; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* Ma trận quyền */
.pmx { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pmx th, .pmx td { border: 1px solid var(--line); padding: 7px 9px; }
.pmx thead th { background: #f7f8fa; font-size: 11.5px; position: sticky; top: 0; z-index: 2; }
.pmx th.rowh { text-align: left; font-weight: 600; background: #fcfcfd; }
.pmx td { text-align: center; }
.pmx tr.grp td { background: #eff2f6; font-weight: 700; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.pmx input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }

/* Sơ đồ tổ chức */
.tree { font-size: 13px; }
.tree .tnode { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; min-width: 0; }
.tree .tnode:hover { background: #f4f6f9; }
.tree .lv2 { margin-left: 26px; }
.tree .lv3 { margin-left: 52px; }
.tree .tdot { width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* Lộ trình */
.path { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 10px; min-width: 0; }
.pstep { flex: 1; min-width: 190px; position: relative; padding-right: 14px; }
.pstep:not(:last-child):after {
  content: ''; position: absolute; right: 4px; top: 30px; width: 10px; height: 10px; border-top: 2px solid var(--line);
  border-right: 2px solid var(--line); transform: rotate(45deg);
}
.pstep .pbox { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; height: 100%; }
.pstep.done .pbox { border-color: var(--ok); background: var(--ok-soft); }
.pstep.now .pbox { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* Biểu đồ */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 168px; padding-top: 8px; min-width: 0; }
.chart-bars .cb { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.chart-bars .cb > i { width: 100%; max-width: 46px; background: linear-gradient(180deg, #ea5b4c, var(--brand)); border-radius: 5px 5px 0 0; display: block; transition: height .5s; }
.chart-bars .cb .cl { font-size: 11px; color: var(--ink-3); text-align: center; line-height: 1.25; }
.chart-bars .cb .cv { font-size: 11.5px; font-weight: 700; }
.donut { width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative; }
.donut .dc { width: 94px; height: 94px; background: #fff; border-radius: 50%; display: grid; place-items: center; text-align: center; line-height: 1.15; }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; min-width: 0; }
.legend .li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Câu hỏi trắc nghiệm */
.qopt {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px;
  cursor: pointer; background: #fff; transition: .12s; min-width: 0;
}
.qopt:hover { border-color: #c9d0da; background: #fbfcfd; }
.qopt.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(211, 33, 48, .12); }
.qopt.right { border-color: var(--ok); background: var(--ok-soft); }
.qopt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.qopt .qk {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; flex: none; background: #fff;
}
.qopt.sel .qk { background: var(--brand); color: #fff; border-color: var(--brand); }
.qopt.right .qk { background: var(--ok); color: #fff; border-color: var(--ok); }
.qopt.wrong .qk { background: var(--bad); color: #fff; border-color: var(--bad); }
.qnav { display: flex; flex-wrap: wrap; gap: 6px; }
.qnav button {
  width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  font-size: 12px; font-weight: 600;
}
.qnav button.ans { background: var(--info-soft); border-color: #b8d3fb; color: #1552b5; }
.qnav button.flag { background: var(--warn-soft); border-color: #f3d38a; }
.qnav button.on { background: var(--nav); border-color: var(--nav); color: #fff; }

/* Chứng chỉ */
.cert {
  border: 8px double #c8a24a; border-radius: 6px; padding: 26px 30px; background: linear-gradient(135deg, #fffdf7, #fff8ea);
  text-align: center; position: relative; overflow: hidden;
}
.cert h2 { margin: 6px 0 2px; font-size: 24px; letter-spacing: .04em; color: #7a5c12; }
.cert .cname { font-size: 27px; font-weight: 800; margin: 14px 0 4px; color: var(--ink); }
.cert .seal {
  position: absolute; right: 24px; bottom: 20px; width: 78px; height: 78px; border-radius: 50%;
  border: 3px solid var(--brand); color: var(--brand); display: grid; place-items: center; font-size: 10px;
  font-weight: 700; transform: rotate(-12deg); opacity: .9; line-height: 1.2; text-align: center; padding: 6px;
}

/* Rubric / đánh giá */
.stars { display: inline-flex; gap: 2px; }
.stars i { width: 15px; height: 15px; display: block; color: #e2e5ea; }
.stars i.on { color: #f5a623; }
.rate-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid #f0f2f5; }
.rt { display: inline-flex; gap: 4px; }
.rt button { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 12px; font-weight: 600; }
.rt button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Dòng thời gian */
.tl { position: relative; padding-left: 26px; }
.tl:before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl .ti { position: relative; padding: 0 0 16px; }
.tl .ti:before { content: ''; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.tl .ti.ok:before { border-color: var(--ok); background: var(--ok); }
.tl .ti.dim:before { border-color: #cbd2dc; }

/* Khác */
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty .eb { font-size: 34px; margin-bottom: 8px; opacity: .55; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-num { background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 20px; }
.demo-note {
  background: linear-gradient(90deg, #fff7ed, #fffbf5); border: 1px solid #f3d9b5; border-radius: 10px;
  padding: 11px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #7a4a00;
}
.kbd { font-family: var(--mono); font-size: 11px; background: #f2f4f7; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }
.scroll-y { overflow-y: auto; }
.hoverable:hover { background: #fafbfd; }
.link { color: var(--info); cursor: pointer; }
.link:hover { text-decoration: underline; }
