/* Giao diện theo bảng học phí Back to School 26 (junsport.vn/back-to-school-26):
   nền đen, panel trắng góc 3px, nhãn in hoa nhỏ, thanh tiêu đề xanh chuối, nút tím, số dùng Bricolage Grotesque. */
:root {
  --page: #0b0a0f;
  --hi: #ffffff;
  --hi-mut: rgba(255, 255, 255, 0.68);
  --hi-line: rgba(255, 255, 255, 0.16);
  --hi-fill: rgba(255, 255, 255, 0.06);
  --panel: #ffffff;
  --ink: #15121f;
  --mut: #5f586e;
  --line: rgba(20, 16, 30, 0.1);
  --line-strong: rgba(20, 16, 30, 0.18);
  --soft: #f4f2ea;
  --purple: #7b2ff7;
  --purple-hover: #6a22e0;
  --purple-tint: rgba(123, 47, 247, 0.07);
  --purple-line: rgba(123, 47, 247, 0.24);
  --lime: #bdef00;
  --lime-tint: #f4fad8;
  --pop: rgba(189, 239, 0, 0.16);
  --danger: #b42318;
  --display: "Bricolage Grotesque", "Be Vietnam Pro", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  background: var(--page);
  color: var(--hi);
  font: 400 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(189, 239, 0, 0.75); outline-offset: 2px; }
.nw { white-space: nowrap; }
.num { font-family: var(--display); font-weight: 800; letter-spacing: -0.01em; }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ---------- Khung ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--page); border-bottom: 1px solid var(--hi-line); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 680px; margin: 0 auto; height: 58px; padding: 0 8px 0 14px; display: flex; align-items: center; gap: 10px; }
.top-logo { width: 34px; height: 34px; flex: none; }
.top-back { width: 40px; height: 40px; margin-left: -8px; display: grid; place-items: center; border-radius: 3px; color: var(--hi); flex: none; }
.top-back:active { background: var(--hi-fill); }
.top-title { flex: 1; min-width: 0; line-height: 1.2; }
.top-title b { display: block; font-family: var(--display); font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title small { display: block; font-size: 12px; color: var(--hi-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-out { height: 36px; padding: 0 12px; border: 1px solid var(--hi-line); border-radius: 3px; color: var(--hi-mut); font-size: 12.5px; font-weight: 700; flex: none; }
.top-out:active { background: var(--hi-fill); }
svg.i { width: 20px; height: 20px; }

.wrap { max-width: 680px; margin: 0 auto; padding: 18px 14px calc(150px + env(safe-area-inset-bottom)); }

.tabs { display: flex; gap: 6px; padding: 5px; margin-bottom: 18px; border: 1px solid var(--hi-line); border-radius: 3px; background: var(--hi-fill); }
.tabs button { flex: 1; min-height: 42px; padding: 0 10px; border-radius: 2px; font-weight: 800; font-size: 14px; color: var(--hi-mut); }
.tabs button[aria-selected="true"] { background: var(--lime); color: var(--ink); }
.tabs small { margin-left: 6px; font-size: 12px; font-weight: 800; opacity: 0.75; }

.intro { margin: 2px 2px 16px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime); }
.intro h1 { margin-top: 4px; font-family: var(--display); font-weight: 800; font-size: clamp(24px, 6.4vw, 30px); line-height: 1.12; letter-spacing: -0.01em; }
.intro p { margin-top: 6px; color: var(--hi-mut); font-size: 14px; }

.panel { background: var(--panel); color: var(--ink); border-radius: 3px; padding: 16px; box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.6); }
.panel + .panel { margin-top: 12px; }

.label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mut); }
.input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}
.input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(123, 47, 247, 0.14); }
.input::placeholder { color: rgba(20, 16, 30, 0.4); font-weight: 500; }
textarea.input { min-height: 112px; padding: 11px 13px; line-height: 1.55; font-weight: 500; resize: vertical; }

.note { display: flex; gap: 9px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--purple-line); border-radius: 3px; background: var(--purple-tint); font-size: 13.5px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.note::before { content: "★"; color: var(--purple); font-weight: 900; flex: none; }
.note.warn { border-color: rgba(180, 35, 24, 0.3); background: rgba(180, 35, 24, 0.06); }
.note.warn::before { content: "!"; color: var(--danger); }
.note + * { margin-top: 14px; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px -16px 0; padding: 10px 16px; background: var(--lime); color: var(--ink); font-size: 12.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.bar::before { content: "★"; color: var(--purple); margin-right: -4px; }
.bar span { flex: 1; }
.bar small { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; text-transform: none; opacity: 0.7; }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px; border-radius: 3px; font-weight: 800; font-size: 15px; white-space: nowrap; transition: background 0.15s ease, transform 0.08s ease; }
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-lime { background: var(--lime); color: var(--ink); font-weight: 900; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover:not(:disabled) { background: var(--purple-hover); }
.btn-ghost { border: 1px solid var(--hi-line); color: var(--hi); }
.btn-line { border: 1px solid var(--line-strong); color: var(--ink); background: #fff; }
.btn-block { width: 100%; }
.link { color: var(--purple); font-weight: 800; font-size: 12.5px; padding: 6px 0 6px 10px; white-space: nowrap; }

/* Nhóm nút chọn (giống bộ lọc trong bảng học phí) */
.seg { display: grid; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--soft); }
.seg.cols-3 { grid-template-columns: repeat(3, 1fr); }
.seg.cols-4 { grid-template-columns: repeat(4, 1fr); }
.seg.cols-5 { grid-template-columns: repeat(5, 1fr); }
.seg button { min-height: 42px; padding: 0 6px; border-radius: 2px; color: var(--mut); font-weight: 700; font-size: 13.5px; }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--purple); color: #fff; }
.seg.score button { font-family: var(--display); font-weight: 800; font-size: 19px; min-height: 46px; color: var(--ink); }
.seg.score button[aria-checked="true"] { color: #fff; }
.seg small { margin-left: 4px; font-size: 11.5px; opacity: 0.75; }

/* Nhãn cấp độ / trạng thái */
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 2px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.tag.lv-CB1 { background: var(--soft); color: var(--ink); border: 1px solid var(--line-strong); }
.tag.lv-CB2 { background: var(--purple); color: #fff; }
.tag.lv-CB3 { background: var(--lime); color: var(--ink); }
.tag.lv-REVIEW { background: var(--ink); color: var(--lime); }
.tag.lv-none { background: transparent; color: var(--mut); border: 1px dashed var(--line-strong); }
.tag.st-pending { border: 1px solid var(--purple-line); color: var(--purple); }
.tag.st-approved { background: var(--purple-tint); color: var(--purple); border: 1px solid var(--purple-line); }
.tag.st-sent { background: var(--lime-tint); color: #3b4a00; border: 1px solid #dcec9c; }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 14px calc(24px + env(safe-area-inset-bottom)); }
.login .panel { width: 100%; max-width: 420px; padding: 26px 20px 22px; }
.login-head { display: flex; align-items: center; gap: 12px; }
.login-head img { width: 52px; height: 52px; }
.login-head .eyebrow { color: var(--purple); }
.login h1 { font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.1; letter-spacing: -0.01em; }
.steps { list-style: none; margin: 20px 0; border-top: 1px solid var(--line); }
.steps li { display: flex; gap: 12px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.steps b { font-family: var(--display); font-weight: 800; color: var(--purple); font-size: 16px; min-width: 16px; }
.gsi { min-height: 44px; display: flex; justify-content: center; }
.login-foot { margin-top: 14px; font-size: 12.5px; color: var(--mut); text-align: center; }
.demo-chip { display: inline-block; margin-bottom: 10px; padding: 3px 8px; border-radius: 2px; background: var(--lime); color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.form { display: grid; gap: 10px; }

/* ---------- Chọn ngày + lớp ---------- */
.date-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.date-row .field { flex: 1 1 150px; min-width: 0; }
.date-row .seg { flex: 0 0 auto; display: flex; }
.date-row .seg button { padding: 0 12px; min-height: 36px; }
.search { margin-top: 12px; }
.meta-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 16px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mut); }

.list { list-style: none; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.rowbtn { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 14px 2px; text-align: left; color: var(--ink); }
.rowbtn:active { background: var(--soft); }
.rowbtn .t { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.2; }
.rowbtn .t.small { font-family: inherit; font-size: 15.5px; }
.rowbtn .m { grid-column: 1; font-size: 13px; color: var(--mut); font-weight: 500; }
.rowbtn .r { grid-row: 1 / span 2; grid-column: 2; text-align: right; display: grid; justify-items: end; gap: 4px; }
.rowbtn .r .num { font-size: 20px; line-height: 1; }
.rowbtn .r > span:not(.tag) { font-size: 11.5px; color: var(--mut); font-weight: 600; }
.track { grid-column: 1 / -1; height: 4px; margin-top: 8px; background: var(--soft); border-radius: 2px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--lime); }

.empty { padding: 28px 10px; text-align: center; color: var(--mut); font-size: 14px; }
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 18px; margin-bottom: 4px; }
.skeleton { height: 64px; margin: 8px 0; border-radius: 3px; background: linear-gradient(90deg, var(--soft), #fbfaf6, var(--soft)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Chọn học viên ---------- */
.pick { display: flex; align-items: center; gap: 12px; padding: 13px 2px; cursor: pointer; }
.pick input { width: 22px; height: 22px; flex: none; accent-color: var(--purple); }
.pick input:disabled { opacity: 0.4; }
.pick .who { flex: 1; min-width: 0; }
.pick .who b { display: block; font-weight: 700; font-size: 15.5px; }
.pick .who small { display: block; color: var(--mut); font-size: 12.5px; }
.pick:has(input:checked) .who b { color: var(--purple); }
.select-all { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--mut); font-weight: 600; }
.select-all button { color: var(--purple); font-weight: 800; font-size: 13px; padding: 6px 0; }

/* ---------- Chấm điểm ---------- */
.steps-nav { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 14px; padding: 2px; scrollbar-width: none; }
.steps-nav::-webkit-scrollbar { display: none; }
.steps-nav button { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--hi-line); border-radius: 3px; background: var(--hi-fill); color: var(--hi-mut); font-weight: 700; font-size: 13px; }
.steps-nav button.done { color: var(--lime); border-color: rgba(189, 239, 0, 0.45); }
.steps-nav button[aria-current="true"] { background: var(--lime); border-color: var(--lime); color: var(--ink); }

.who-head h2 { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.15; letter-spacing: -0.01em; }
.who-head p { margin-top: 4px; color: var(--mut); font-size: 13.5px; }
.who-head .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.who-head .note { margin-top: 12px; }

.crit { padding: 14px 0; border-bottom: 1px solid var(--line); }
.crit:last-child { border-bottom: 0; }
.crit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.crit-head b { display: block; font-weight: 800; font-size: 15.5px; }
.crit-head small { display: block; color: var(--mut); font-size: 12px; }
.desc { margin-top: 9px; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.desc b { font-weight: 800; }
.desc.muted { color: var(--mut); }
.desc .warn { color: var(--danger); font-weight: 700; }
.guide { list-style: none; margin-top: 10px; border: 1px solid var(--line); border-radius: 3px; }
.guide li { padding: 8px 10px; font-size: 13px; color: var(--mut); border-bottom: 1px solid var(--line); }
.guide li:last-child { border-bottom: 0; }
.guide li b { color: var(--ink); }
.guide li.on { background: var(--pop); color: var(--ink); }
.field-gap { margin-top: 14px; }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--mut); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { min-height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 2px; background: #fff; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.orig { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--line-strong); background: var(--soft); font-size: 13px; color: var(--mut); }
.orig b { color: var(--ink); }
details.log { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
details.log summary { cursor: pointer; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mut); }
details.log ol { list-style: none; margin-top: 8px; display: grid; gap: 6px; }
details.log li { font-size: 12.5px; color: var(--mut); line-height: 1.45; }

/* ---------- Thanh dưới ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(11, 10, 15, 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--hi-line); padding-bottom: env(safe-area-inset-bottom); }
.dock-in { max-width: 680px; margin: 0 auto; padding: 10px 14px 12px; display: grid; gap: 10px; }
.dock-sum { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.dock-sum .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hi-mut); }
.dock-sum .num { font-size: 26px; color: var(--lime); margin-left: 8px; vertical-align: -3px; }
.dock-sum .tag.lv-none { color: var(--hi-mut); border-color: var(--hi-line); }
.dock-sum .tag.lv-CB1 { background: #fff; }
.dock-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.dock-row.one { grid-template-columns: 1fr; }
.dock-row.two { grid-template-columns: 1fr 1fr; }

/* ---------- Xem lại / Hoàn tất ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { padding: 10px 8px; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.stat .num { display: block; font-size: 22px; line-height: 1; color: var(--purple); }
.stat span { display: block; margin-top: 4px; font-size: 11.5px; font-weight: 600; color: var(--mut); }
.rev { padding: 14px 0; border-bottom: 1px solid var(--line); }
.rev:last-child { border-bottom: 0; }
.rev-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rev-top b { display: block; font-weight: 800; font-size: 15.5px; }
.rev-top small { display: block; color: var(--mut); font-size: 12.5px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pill { font-size: 12px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 2px; color: var(--mut); background: #fff; }
.pill b { color: var(--ink); }
.rev p { margin-top: 8px; font-size: 13px; color: var(--ink); }
.rev p.warn { color: var(--danger); font-weight: 600; }
.rev .link { display: inline-block; margin-top: 4px; padding-left: 0; }

.done { text-align: center; padding: 18px 4px 4px; }
.done-mark { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 3px; background: var(--lime); color: var(--ink); display: grid; place-items: center; }
.done-mark svg { width: 32px; height: 32px; }
.done h2 { font-family: var(--display); font-weight: 800; font-size: 24px; }
.done p { margin-top: 6px; color: var(--mut); font-size: 14px; }
.done .stats { margin-top: 18px; text-align: left; }

/* ---------- Xem trước email ---------- */
.mail-meta { display: grid; gap: 4px; font-size: 13.5px; }
.mail-meta b { font-weight: 800; }
.mail-frame { width: 100%; height: 70vh; margin-top: 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--soft); }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(160px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  width: max-content;
  max-width: min(440px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 3px;
  background: var(--lime);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
}
#toast.error { background: #fff; color: var(--danger); border-left: 4px solid var(--danger); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
