
:root{
  --dna-primary:#4f46e5;
  --dna-primary-2:#7c3aed;
  --dna-accent:#0ea5e9;
  --dna-success:#16a34a;
  --dna-warning:#d97706;
  --dna-danger:#dc2626;
  --dna-ink:#172033;
  --dna-muted:#64748b;
  --dna-soft:#f6f8fc;
  --dna-line:#e6eaf1;
  --dna-sidebar:#111827;
}

/* AJAX-first list states */
[data-ajax-page]{position:relative;outline:none}
[data-ajax-page].ajax-list-loading{min-height:120px;pointer-events:none;opacity:.62}
[data-ajax-page].ajax-list-loading::after{content:"";position:absolute;top:1rem;right:1rem;width:1.5rem;height:1.5rem;border:.2rem solid rgba(79,70,229,.2);border-top-color:#4f46e5;border-radius:50%;animation:mathdna-spin .7s linear infinite;z-index:20}
@keyframes mathdna-spin{to{transform:rotate(360deg)}}
html,body{min-height:100%}
body{background:var(--dna-soft);color:var(--dna-ink);font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif}
a{text-decoration:none}
.app-shell{min-height:100vh}
.app-sidebar{width:280px;background:linear-gradient(180deg,#111827 0%,#18213a 100%);color:#fff;position:fixed;inset:0 auto 0 0;z-index:1040;overflow-y:auto;box-shadow:10px 0 30px rgba(15,23,42,.08)}
.app-main{margin-left:280px;min-height:100vh}
.app-topbar{height:72px;background:rgba(255,255,255,.94);backdrop-filter:blur(14px);border-bottom:1px solid var(--dna-line);position:sticky;top:0;z-index:1020}
.brand-mark{width:42px;height:42px;border-radius:14px;background:linear-gradient(135deg,#818cf8,#7c3aed);display:grid;place-items:center;color:#fff;box-shadow:0 8px 22px rgba(79,70,229,.28)}
.brand-title{font-weight:800;letter-spacing:-.02em}
.brand-sub{font-size:.76rem;color:#94a3b8}
.sidebar-link{display:flex;align-items:center;gap:.75rem;padding:.78rem .9rem;margin:.22rem .55rem;border-radius:12px;color:#cbd5e1;font-weight:600}
.sidebar-link:hover,.sidebar-link.active{background:rgba(255,255,255,.10);color:#fff}
.sidebar-link i{font-size:1.08rem;width:22px;text-align:center}
.sidebar-section{font-size:.68rem;letter-spacing:.12em;text-transform:uppercase;color:#64748b;font-weight:800;padding:1rem 1.45rem .35rem}
.page-wrap{padding:24px 28px 48px}
.page-title{font-weight:800;letter-spacing:-.025em;margin-bottom:.25rem}
.page-subtitle{color:var(--dna-muted);margin:0}
.card-dna{border:1px solid var(--dna-line);border-radius:18px;box-shadow:0 8px 28px rgba(15,23,42,.045);overflow:hidden}
.card-dna .card-header{background:#fff;border-bottom:1px solid var(--dna-line);padding:1rem 1.15rem}
.card-dna .card-body{padding:1.15rem}
.metric-card{position:relative;min-height:138px}
.metric-icon{width:46px;height:46px;border-radius:14px;display:grid;place-items:center;font-size:1.3rem}
.metric-value{font-size:2rem;font-weight:850;letter-spacing:-.04em}
.metric-label{color:var(--dna-muted);font-size:.9rem}
.bg-soft-primary{background:#eef2ff;color:#4f46e5}
.bg-soft-info{background:#e0f2fe;color:#0284c7}
.bg-soft-success{background:#dcfce7;color:#15803d}
.bg-soft-warning{background:#fef3c7;color:#b45309}
.bg-soft-danger{background:#fee2e2;color:#b91c1c}
.badge-soft{background:#f1f5f9;color:#475569;border:1px solid #e2e8f0}
.progress-thin{height:8px;background:#edf1f7}
.progress-thin .progress-bar{border-radius:999px}
.mastery-row{padding:.78rem 0;border-bottom:1px dashed #e7ebf1}.mastery-row:last-child{border-bottom:0}
.dna-score{font-weight:800}
.priority-rank{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:#eef2ff;color:#4f46e5;font-weight:800}
.error-pill{display:inline-flex;align-items:center;gap:.35rem;border:1px solid #e5e7eb;border-radius:999px;padding:.35rem .55rem;background:#fff;font-size:.78rem;font-weight:700}
.question-card{max-width:900px;margin-inline:auto}
.answer-option{position:relative;display:block;border:1.5px solid #e2e8f0;border-radius:15px;padding:1rem 1.1rem;margin:.7rem 0;cursor:pointer;transition:.18s ease;background:#fff}
.answer-option:hover{border-color:#818cf8;background:#f8f7ff;transform:translateY(-1px)}
.answer-option input{position:absolute;opacity:0}
.answer-option:has(input:checked){border-color:#4f46e5;background:#eef2ff;box-shadow:0 0 0 3px rgba(79,70,229,.08)}
.option-key{width:30px;height:30px;border-radius:9px;background:#f1f5f9;display:inline-grid;place-items:center;font-weight:800;margin-right:.55rem}
.answer-option:has(input:checked) .option-key{background:#4f46e5;color:#fff}
.feedback-box{border-radius:16px;padding:1rem 1.1rem}
.feedback-good{background:#ecfdf3;border:1px solid #bbf7d0}
.feedback-bad{background:#fff1f2;border:1px solid #fecdd3}
.knowledge-node{border:1px solid #e5e7eb;border-radius:14px;padding:.8rem;background:#fff}
.table-modern{--bs-table-bg:transparent}
.table-modern thead th{font-size:.78rem;color:#64748b;text-transform:uppercase;letter-spacing:.045em;border-bottom:1px solid #e5e7eb}
.table-modern td{vertical-align:middle}
.empty-state{padding:2.5rem;text-align:center;color:#64748b}
.empty-state i{font-size:2.25rem;color:#cbd5e1}
.login-page{min-height:100vh;background:
 radial-gradient(circle at 15% 15%,rgba(99,102,241,.22),transparent 28%),
 radial-gradient(circle at 85% 80%,rgba(14,165,233,.18),transparent 30%),
 #f7f8fc}
.login-card{max-width:430px;border:1px solid rgba(255,255,255,.5);border-radius:22px;box-shadow:0 22px 70px rgba(30,41,59,.12)}
.login-side{background:linear-gradient(135deg,#312e81 0%,#4f46e5 45%,#0ea5e9 100%);color:#fff;border-radius:26px;min-height:560px;position:relative;overflow:hidden}
.login-side:before{content:"";position:absolute;width:300px;height:300px;border-radius:50%;border:55px solid rgba(255,255,255,.08);right:-90px;top:-80px}
.login-side:after{content:"";position:absolute;width:260px;height:260px;border-radius:50%;background:rgba(255,255,255,.06);left:-90px;bottom:-90px}
.offcanvas-dna{background:#111827;color:#fff}
.chart-wrap{position:relative;min-height:300px}
.student-chip{display:inline-flex;align-items:center;gap:.45rem;background:#f8fafc;border:1px solid #e2e8f0;border-radius:999px;padding:.34rem .65rem;font-size:.8rem}
.form-control,.form-select{border-color:#dbe2ea;border-radius:12px;padding:.68rem .8rem}
.form-control:focus,.form-select:focus{border-color:#818cf8;box-shadow:0 0 0 .22rem rgba(79,70,229,.12)}
.btn{border-radius:12px;font-weight:700}
.btn-primary{--bs-btn-bg:#4f46e5;--bs-btn-border-color:#4f46e5;--bs-btn-hover-bg:#4338ca;--bs-btn-hover-border-color:#4338ca}
.alert{border-radius:14px}
.footer-note{font-size:.78rem;color:#94a3b8}
@media(max-width:991.98px){
  .app-sidebar{display:none}
  .app-main{margin-left:0}
  .page-wrap{padding:20px 16px 38px}
}


/* ===== MathDNA v3.0.11 - Login presentation refresh ===== */
.login-platform-title{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:.85rem 1rem;
  border-radius:14px;
  background:linear-gradient(135deg,#4f46e5 0%,#7c3aed 55%,#0ea5e9 100%);
  color:#fff;
  font-size:.88rem;
  font-weight:900;
  letter-spacing:.055em;
  line-height:1.35;
  box-shadow:0 10px 28px rgba(79,70,229,.22);
}
.login-credit{
  text-align:center;
  color:#64748b;
  font-size:.82rem;
  font-weight:700;
  line-height:1.5;
}
.login-feature-tile{
  height:100%;
  padding:.9rem .55rem;
  border-radius:16px;
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.11);
  text-align:center;
  backdrop-filter:blur(5px);
}
.login-feature-tile small{
  color:rgba(255,255,255,.68);
}
.login-card{
  position:relative;
  overflow:hidden;
}
.login-card:before{
  content:"";
  position:absolute;
  width:160px;
  height:160px;
  border-radius:50%;
  background:radial-gradient(circle,rgba(79,70,229,.10),transparent 68%);
  top:-60px;
  right:-55px;
  pointer-events:none;
}
.login-card > *{
  position:relative;
  z-index:1;
}
@media(max-width:575.98px){
  .login-platform-title{
    font-size:.78rem;
    padding:.78rem .7rem;
    letter-spacing:.035em;
  }
  .login-card{
    padding:1.5rem !important;
  }
}

/* ===== MathDNA v3.1.0: RBAC / Avatar / Branding ===== */
.brand-logo-box{width:42px;height:42px;border-radius:13px;display:flex;align-items:center;justify-content:center;overflow:hidden;flex:0 0 auto;box-shadow:0 8px 22px rgba(31,38,135,.18)}
.brand-logo-box img{width:100%;height:100%;object-fit:cover}
.avatar-xs,.avatar-sm,.avatar-md,.avatar-xl{object-fit:cover;border-radius:50%;background:#eef2ff;border:2px solid rgba(255,255,255,.8);flex:0 0 auto}
.avatar-xs{width:30px;height:30px}.avatar-sm{width:42px;height:42px}.avatar-md{width:48px;height:48px}.avatar-xl{width:112px;height:112px;box-shadow:0 10px 30px rgba(15,23,42,.12)}
.min-w-0{min-width:0}


/* ===== v3.1.0: Password visibility ===== */
.password-toggle-wrap{position:relative}
.password-toggle-wrap .form-control{padding-right:3rem}
.password-toggle-btn{
  position:absolute;right:.55rem;top:50%;transform:translateY(-50%);
  width:2.15rem;height:2.15rem;border:0;background:transparent;
  color:#64748b;border-radius:.65rem;display:flex;align-items:center;justify-content:center;
  transition:.15s ease;
}
.password-toggle-btn:hover{background:#eef2ff;color:#4f46e5}
.password-toggle-btn:focus{outline:2px solid rgba(79,70,229,.22);outline-offset:1px}


/* ===== MathDNA v3.1.0 - Staff Overview / Mobile-first ===== */
.overview-kicker{
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.11em;
  color:#6366f1;
  margin-bottom:.35rem;
}
.overview-class-picker{min-width:220px}
.overview-stat-card{
  display:flex;
  flex-direction:column;
  height:100%;
  min-height:168px;
  padding:1rem;
  border:1px solid #e5e7eb;
  border-radius:18px;
  background:#fff;
  color:#111827;
  text-decoration:none;
  box-shadow:0 8px 24px rgba(15,23,42,.05);
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.overview-stat-card:hover{
  color:#111827;
  transform:translateY(-2px);
  border-color:#c7d2fe;
  box-shadow:0 14px 32px rgba(15,23,42,.09);
}
.overview-stat-card.compact{min-height:154px}
.overview-stat-icon{
  width:42px;height:42px;border-radius:13px;
  display:flex;align-items:center;justify-content:center;
  background:#eef2ff;color:#4f46e5;font-size:1.15rem;margin-bottom:.75rem
}
.overview-stat-value{font-size:1.65rem;font-weight:850;line-height:1.05}
.overview-stat-label{font-weight:700;margin-top:.28rem;font-size:.92rem}
.overview-stat-link{margin-top:auto;padding-top:.75rem;color:#6366f1;font-size:.78rem;font-weight:700}
.overview-list-link,.overview-student-link{
  display:flex;align-items:center;justify-content:space-between;gap:1rem;
  color:#111827;text-decoration:none;border:1px solid #e5e7eb;border-radius:14px;
  padding:.85rem .95rem;margin-bottom:.65rem;background:#fff
}
.overview-list-link:hover,.overview-student-link:hover{background:#f8fafc;border-color:#c7d2fe;color:#111827}
.overview-quick-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:.75rem;
}
.overview-quick{
  min-height:96px;padding:.9rem;border:1px solid #e5e7eb;border-radius:15px;
  text-decoration:none;color:#111827;display:flex;flex-direction:column;justify-content:center;gap:.4rem;
  background:#fff;font-weight:700
}
.overview-quick i{font-size:1.2rem;color:#4f46e5}
.overview-quick:hover{background:#f8fafc;border-color:#c7d2fe;color:#111827}
.overview-audit-item{padding:.7rem 0;border-bottom:1px solid #eef2f7}
.overview-audit-item:last-child{border-bottom:0}
@media(max-width:767.98px){
  .page-wrap{padding-left:.75rem!important;padding-right:.75rem!important}
  .overview-class-picker{width:100%;min-width:0}
  .overview-stat-card{min-height:145px;padding:.85rem;border-radius:16px}
  .overview-stat-card.compact{min-height:145px}
  .overview-stat-icon{width:38px;height:38px;margin-bottom:.55rem}
  .overview-stat-value{font-size:1.42rem}
  .overview-stat-label{font-size:.82rem}
  .overview-stat-link{font-size:.72rem}
  .overview-quick-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}
  .overview-quick{min-height:88px;padding:.75rem;font-size:.86rem}
}

/* ===== Presence / Online ===== */
.online-dot{
  display:inline-block;width:.62rem;height:.62rem;border-radius:50%;
  background:#22c55e;box-shadow:0 0 0 4px rgba(34,197,94,.12);
  vertical-align:middle;flex:0 0 auto
}
.presence-card .overview-stat-icon{background:#ecfdf5;color:#16a34a}
@media(max-width:767.98px){
  .table-modern th,.table-modern td{white-space:nowrap}
}

.presence-compact{display:flex;flex-direction:column;gap:.2rem;margin:0 0 .9rem .1rem;font-size:.82rem}
.presence-compact a{color:#64748b;text-decoration:none;font-weight:600}
.presence-compact a:hover{color:#4f46e5;text-decoration:underline}
.presence-compact .online-dot{width:.48rem;height:.48rem;margin-right:.25rem}
@media(max-width:767.98px){.presence-compact{font-size:.78rem;margin-bottom:.75rem}}


/* ===== MathDNA canonical online-status indicator =====
   Quy ước UI: chấm xanh CSS = đang trực tuyến. Không dùng emoji. */
.online-dot{
  display:inline-block;
  width:.58rem;
  height:.58rem;
  min-width:.58rem;
  border-radius:50%;
  background:#22c55e;
  border:2px solid rgba(255,255,255,.95);
  box-shadow:0 0 0 2px rgba(34,197,94,.18);
  vertical-align:middle;
  position:relative;
}
.online-dot.online-dot-live::after{
  content:"";
  position:absolute;
  inset:-5px;
  border-radius:50%;
  border:1px solid rgba(34,197,94,.38);
  animation:mathdna-online-pulse 2.2s ease-out infinite;
}
@keyframes mathdna-online-pulse{
  0%{transform:scale(.72);opacity:.65}
  70%,100%{transform:scale(1.35);opacity:0}
}
@media (prefers-reduced-motion: reduce){
  .online-dot.online-dot-live::after{animation:none}
}
