/* ================================================================
   AURORA LMS — Design System v2.0
   File: backend/static/css/aurora.css
   HPU2 · LCMS-LMS Platform · 2026
   Classes khớp với base_aurora.html + dashboard.html
================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════
   1. DESIGN TOKENS
══════════════════════════════════════════ */
:root {
  --font: 'Inter','Segoe UI',system-ui,sans-serif;

  /* Brand */
  --brand-red:    #a00d24;
  --brand-navy:   #071A4F;
  --brand-red2:   #dc2626;
  --brand-blue2:  #3b82f6;

  /* Background (light) */
  --bg-page:      #f0f2f7;
  --bg-sidebar:   #071A4F;
  --bg-topbar:    #ffffff;
  --bg-card:      #ffffff;
  --bg-hover:     #f8fafc;

  /* Text */
  --text-primary:   #1e293b;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-white:     #ffffff;

  /* Border */
  --border-light: #f1f5f9;
  --border-mid:   #e2e8f0;

  /* Shadow */
  --shadow-sm:  0 1px 4px rgba(7,26,79,.06);
  --shadow-md:  0 2px 12px rgba(7,26,79,.08);
  --shadow-lg:  0 6px 24px rgba(7,26,79,.13);

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  14px;
  --r-xl:  18px;
  --r-full: 9999px;

  /* Layout */
  --sidebar-w:   256px;
  --topbar-h:    62px;
  --right-w:     260px;
  --content-px:  24px;

  /* Transition */
  --t-fast: all 0.15s ease;
  --t-base: all 0.25s ease;
}

/* ══════════════════════════════════════════
   2. RESET
══════════════════════════════════════════ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; -webkit-text-size-adjust:100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration:none; color:inherit; }
button { cursor:pointer; font-family:var(--font); }

/* ══════════════════════════════════════════
   3. LAYOUT SHELL
══════════════════════════════════════════ */
/* Sidebar cố định bên trái */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  transition: var(--t-base);
}

/* 👇 THÊM MỚI: vùng nav có thể cuộn riêng */
.sidebar-nav-scroll {
  flex: 1 1 auto;
  min-height: 0;          /* bắt buộc để flex-item co lại đúng, kích hoạt scroll */
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}
.sidebar-nav-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* Wrapper bên phải sidebar */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-px);
  z-index: 100;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

/* Content area (chứa main-content + right-panel) */
.content-area {
  flex: 1;
  display: flex;
  gap: 20px;
  padding: 20px var(--content-px);
  align-items: flex-start;
}

/* Main content (giữa) */
.main-content {
  flex: 1;
  min-width: 0;

}
/* ══════════════════════════════════════════
   FULL-WIDTH PAGE OVERRIDE
   Dùng cho dashboard, report, attendance...
   Thêm body_class "page-full" vào template
══════════════════════════════════════════ */
body.page-full .content-area {
  padding: 0;
  gap: 0;
  display: block;
  width: 100%;
}

/* Right panel */
.right-panel {
  width: var(--right-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ══════════════════════════════════════════
   4. SIDEBAR — LOGO
══════════════════════════════════════════ */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-logo-box {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-red), #ff4d6d);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(160,13,36,.4);
}

.sidebar-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}
.sidebar-logo-text span {
  color: #ff6b8a;
}

/* ══════════════════════════════════════════
   5. SIDEBAR — NAV
══════════════════════════════════════════ */
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 16px 6px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  margin: 1px 8px;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  font-weight: 500;
  transition: var(--t-fast);
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .8;
}

.sidebar-nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav-item:hover i { opacity: 1; }

.sidebar-nav-item.active {
  background: rgba(160,13,36,.25);
  color: #fff;
  border: 1px solid rgba(160,13,36,.35);
}
.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(var(--brand-red), #ff4d6d);
  border-radius: 0 3px 3px 0;
}
.sidebar-nav-item.active i { opacity: 1; color: #ff6b8a; }

.sidebar-nav-badge {
  margin-left: auto;
  background: rgba(160,13,36,.5);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 10px 16px;
}

/* ══════════════════════════════════════════
   6. SIDEBAR — BOTTOM UPGRADE CARD
══════════════════════════════════════════ */
.sidebar-bottom {
  flex-shrink: 0;
  padding: 12px 10px 16px;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-upgrade-card {
  background: linear-gradient(135deg, rgba(160,13,36,.3), rgba(7,26,79,.5));
  border: 1px solid rgba(160,13,36,.25);
  border-radius: var(--r-lg);
  padding: 14px;
  text-align: center;
}
.sidebar-upgrade-card h4 {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.sidebar-upgrade-card p {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  margin-bottom: 10px;
  line-height: 1.4;
}
.sidebar-upgrade-btn {
  width: 100%;
  padding: 8px;
  background: linear-gradient(135deg, var(--brand-red), #ff4d6d);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--t-fast);
}
.sidebar-upgrade-btn:hover {
  box-shadow: 0 4px 14px rgba(160,13,36,.5);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════
   7. TOPBAR COMPONENTS
══════════════════════════════════════════ */
.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}
.topbar-title i {
  color: var(--brand-red);
  font-size: 18px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  padding: 8px 14px;
  flex: 1;
  max-width: 360px;
  transition: var(--t-fast);
}
.topbar-search:focus-within {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(160,13,36,.08);
}
.topbar-search i { color: var(--text-muted); font-size: 14px; }
.topbar-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
  font-family: var(--font);
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-kbd {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--bg-page);
  border: 1px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: var(--t-fast);
  text-decoration: none;
  cursor: pointer;
}
.topbar-icon-btn:hover {
  background: var(--border-light);
  color: var(--text-primary);
  text-decoration: none;
}
.topbar-notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--brand-red);
  border-radius: 50%;
  border: 2px solid var(--bg-topbar);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(160,13,36,.4); }
  50%      { box-shadow: 0 0 0 4px rgba(160,13,36,0); }
}

.topbar-divider {
  width: 1px; height: 28px;
  background: var(--border-mid);
  margin: 0 4px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: var(--t-fast);
  position: relative;
  user-select: none;
}
.topbar-user:hover { background: var(--bg-page); }

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-red));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.topbar-user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Topbar User Dropdown ─────────────────────────────────── */
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.1);
  z-index: 9999;
  overflow: hidden;
  animation: udFadeIn 0.18s ease;
}
.user-dropdown.show { display: block; }

@keyframes udFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* Header */
.ud-header {
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 50%, #c0392b 100%);
  padding: 20px 18px 16px;
  position: relative;
  overflow: hidden;
}
.ud-header::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.ud-header::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -10px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.ud-avatar-lg {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  position: relative; z-index: 1;
}
.ud-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  position: relative; z-index: 1;
}
.ud-email {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
  position: relative; z-index: 1;
}
.ud-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 3px 9px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  font-size: 11px;
  color: #fff;
  font-weight: 500;
  position: relative; z-index: 1;
}

/* Menu */
.ud-menu { padding: 8px 0; }

.ud-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  font-size: 13.5px;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
}
.ud-item:hover {
  background: #fef5f5;
  color: #c0392b;
  padding-left: 22px;
}
.ud-item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #f5f5f5;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: #666;
  flex-shrink: 0;
  transition: all 0.15s;
}
.ud-item:hover .ud-item-icon {
  background: #fde8e8;
  color: #c0392b;
}
.ud-item-text { flex: 1; }
.ud-item-text .ud-label {
  font-weight: 500;
  display: block;
  font-size: 13.5px;
}
.ud-item-text .ud-sublabel {
  font-size: 11px;
  color: #aaa;
  display: block;
  margin-top: 1px;
}
.ud-item:hover .ud-item-text .ud-sublabel { color: #e88; }
.ud-item-arrow { font-size: 10px; color: #ccc; }
.ud-item:hover .ud-item-arrow { color: #e88; }

.ud-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 4px 12px;
}

/* Logout */
.ud-item.ud-logout .ud-item-icon {
  background: #fff0f0;
  color: #e74c3c;
}
.ud-item.ud-logout { color: #e74c3c; }
.ud-item.ud-logout:hover { background: #fff0f0; color: #c0392b; }
.ud-item.ud-logout:hover .ud-item-icon { background: #fde8e8; }

/* Footer */
.ud-footer {
  padding: 10px 18px;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ud-footer-text { font-size: 11px; color: #bbb; }
.ud-online-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #27ae60;
  box-shadow: 0 0 0 2px rgba(39,174,96,0.2);
  display: inline-block;
  margin-right: 4px;
}


/* ══════════════════════════════════════════
   8. SECTION HEADER (dùng trong dashboard)
══════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px; height: 16px;
  background: linear-gradient(var(--brand-red), var(--brand-navy));
  border-radius: 2px;
  flex-shrink: 0;
}
.section-link {
  font-size: 12px;
  color: var(--brand-red);
  font-weight: 600;
  text-decoration: none;
  transition: var(--t-fast);
}
.section-link:hover { text-decoration: underline; color: var(--brand-red); }

/* ══════════════════════════════════════════
   9. STAT CARD (dùng trong dashboard)
══════════════════════════════════════════ */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-md);
  transition: var(--t-base);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-card-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.stat-card-icon.red   { background: linear-gradient(135deg,#a00d24,#dc2626); }
.stat-card-icon.blue  { background: linear-gradient(135deg,#071A4F,#3b82f6); }
.stat-card-icon.gold  { background: linear-gradient(135deg,#d97706,#f59e0b); }
.stat-card-icon.teal  { background: linear-gradient(135deg,#0891b2,#22d3ee); }
.stat-card-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-full);
}
.stat-card-trend.up { background: #f0fdf4; color: #16a34a; }
.stat-card-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ══════════════════════════════════════════
   10. COURSE / REC GRID (dùng trong dashboard)
══════════════════════════════════════════ */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.rec-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--t-base);
}
.rec-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.rec-thumb {
  height: 110px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.rec-thumb.c1 { background: linear-gradient(135deg,#071A4F,#1d4ed8); }
.rec-thumb.c2 { background: linear-gradient(135deg,#a00d24,#dc2626); }
.rec-thumb.c3 { background: linear-gradient(135deg,#d97706,#f59e0b); }
.rec-thumb.c4 { background: linear-gradient(135deg,#0891b2,#06b6d4); }
.rec-thumb-icon { font-size: 32px; color: rgba(255,255,255,.35); }
.rec-thumb-badge {
  position: absolute; top: 8px; right: 8px;
  background: #a00d24; color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-full);
}
.rec-body { padding: 12px 14px 14px; }
.rec-title {
  font-size: 13px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rec-author { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.rec-footer { display: flex; align-items: center; justify-content: space-between; }
.rec-rating { font-size: 11px; color: #d97706; font-weight: 600; }
.rec-rating i { margin-right: 2px; }
.rec-price { font-size: 11px; font-weight: 700; color: #16a34a; }

/* ══════════════════════════════════════════
   11. BUTTONS
══════════════════════════════════════════ */
.au-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 600;
  transition: var(--t-fast);
  cursor: pointer; border: 1px solid transparent;
  white-space: nowrap; text-decoration: none;
  font-family: var(--font);
}
.au-btn--primary {
  background: linear-gradient(135deg,var(--brand-navy),var(--brand-red));
  color: #fff;
  box-shadow: 0 4px 14px rgba(160,13,36,.3);
}
.au-btn--primary:hover {
  box-shadow: 0 6px 20px rgba(160,13,36,.45);
  transform: translateY(-1px); color: #fff;
}
.au-btn--secondary {
  background: var(--bg-page);
  color: var(--text-primary);
  border-color: var(--border-mid);
}
.au-btn--secondary:hover { background: var(--border-light); }
.au-btn--danger {
  background: linear-gradient(135deg,#ef4444,#dc2626);
  color: #fff;
}
.au-btn--sm { padding: 6px 12px; font-size: 12px; }
.au-btn--lg { padding: 12px 24px; font-size: 14px; }

/* ══════════════════════════════════════════
   12. BADGE
══════════════════════════════════════════ */
.au-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.au-badge--success { background: #f0fdf4; color: #16a34a; }
.au-badge--warning { background: #fff7ed; color: #d97706; }
.au-badge--error   { background: #fef2f2; color: #dc2626; }
.au-badge--info    { background: #eff6ff; color: #3b82f6; }
.au-badge--muted   { background: var(--bg-page); color: var(--text-muted); }

/* ══════════════════════════════════════════
   13. PROGRESS BAR
══════════════════════════════════════════ */
.au-progress {
  height: 6px;
  background: var(--border-light);
  border-radius: var(--r-full);
  overflow: hidden;
}
.au-progress--sm { height: 4px; }
.au-progress--lg { height: 8px; }
.au-progress__fill {
  height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg,var(--brand-navy),var(--brand-red));
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

/* ══════════════════════════════════════════
   14. FORM ELEMENTS
══════════════════════════════════════════ */
.au-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--t-fast);
  font-family: var(--font);
}
.au-input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(160,13,36,.08);
  outline: none;
}
.au-input::placeholder { color: var(--text-muted); }
.au-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ══════════════════════════════════════════
   15. TABLE
══════════════════════════════════════════ */
.au-table { width: 100%; border-collapse: collapse; }
.au-table th {
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-page);
}
.au-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--t-fast);
}
.au-table tr:hover td { background: var(--bg-hover); }
.au-table tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════
   16. DJANGO MESSAGES
══════════════════════════════════════════ */
.au-msg {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--r-md);
  margin-bottom: 8px; font-size: 13px;
  animation: au-fade-in 0.3s ease;
}
.au-msg--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.au-msg--error,
.au-msg--danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.au-msg--warning { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.au-msg--info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.au-msg__close {
  margin-left: auto; background: none; border: none;
  font-size: 18px; cursor: pointer; line-height: 1; padding: 0;
  opacity: .6;
}
.au-msg__close:hover { opacity: 1; }

/* ══════════════════════════════════════════
   17. CARD COMPONENT
══════════════════════════════════════════ */
.au-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 20px;
  transition: var(--t-base);
}
.au-card:hover { box-shadow: var(--shadow-lg); }
.au-card--sm   { padding: 14px; border-radius: var(--r-md); }
.au-card--lg   { padding: 28px; border-radius: var(--r-xl); }
.au-card--lift:hover { transform: translateY(-3px); }

/* ══════════════════════════════════════════
   18. SCROLLBAR
══════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ══════════════════════════════════════════
   19. ANIMATIONS
══════════════════════════════════════════ */
@keyframes au-fade-in  { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes au-slide-in { from{opacity:0;transform:translateX(-16px)} to{opacity:1;transform:translateX(0)} }
@keyframes au-scale-in { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:scale(1)} }

.au-anim-fade  { animation: au-fade-in  0.4s ease both; }
.au-anim-slide { animation: au-slide-in 0.4s ease both; }
.au-anim-scale { animation: au-scale-in 0.3s ease both; }

.au-d1{animation-delay:.05s} .au-d2{animation-delay:.10s}
.au-d3{animation-delay:.15s} .au-d4{animation-delay:.20s}
.au-d5{animation-delay:.25s} .au-d6{animation-delay:.30s}

/* ══════════════════════════════════════════
   20. UTILITIES
══════════════════════════════════════════ */
.au-divider { height:1px; background:var(--border-light); margin:16px 0; }
.text-muted  { color: var(--text-muted) !important; }
.text-red    { color: var(--brand-red) !important; }
.text-navy   { color: var(--brand-navy) !important; }

/* ══════════════════════════════════════════
   21. RESPONSIVE
══════════════════════════════════════════ */
@media (max-width:1280px) {
  :root { --right-w: 230px; --content-px: 18px; }
  .rec-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width:1024px) {
  :root { --right-w: 0px; --content-px: 16px; }
  .right-panel { display: none; }
}
@media (max-width:768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .topbar-search { display: none; }
  .content-area { padding: 14px; }
  .rec-grid { grid-template-columns: 1fr; }
}
/* ═══════════════════════════════════════════════════════════
/* ═══════════════════════════════════════════════════════════
   AURORA FORM SYSTEM v2.0  (cho template _form_base.html)
   → Thêm vào CUỐI aurora.css
   ═══════════════════════════════════════════════════════════ */

:root {
  --af-primary: #6366f1;
  --af-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --af-grad-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  --af-border: #e2e8f0;
  --af-text: #1e293b;
  --af-muted: #64748b;
  --af-radius: 14px;
  --af-topbar-h: 64px;
  --af-gap: 16px;
}

/* ═══ KHUNG FORM = 100vh, KHÔNG cuộn trang ═══ */
.af-screen {
  height: calc(100vh - var(--af-topbar-h));
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  overflow: hidden;
  background: transparent;
}

/* ═══ HEADER (cố định trên) ═══ */
.af-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: var(--af-radius);
  margin-bottom: 14px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(102,126,234,.25);
}
.af-header.af-primary { background: var(--af-grad); }
.af-header.af-success { background: var(--af-grad-success); }
.af-header-left { display: flex; align-items: center; gap: 14px; }
.af-header-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.2);
  border-radius: 12px;
  font-size: 20px;
}
.af-title { font-size: 19px; font-weight: 700; margin: 0; color: #fff; line-height: 1.2; }
.af-subtitle { font-size: 12.5px; opacity: .9; margin: 2px 0 0; }
.af-header-actions .btn-light { background: rgba(255,255,255,.95); color: #475569; }
.af-header-actions .btn-light:hover { background: #fff; }

/* ═══ BODY: GRID responsive (cuộn nội bộ) ═══ */
.af-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: var(--af-gap);
  align-content: start;
  padding-right: 6px;
}
.af-body::-webkit-scrollbar { width: 8px; }
.af-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.af-body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.af-body::-webkit-scrollbar-track { background: transparent; }

/* Card chiếm nguyên hàng (span full) */
.af-card.af-span-2 { grid-column: 1 / -1; }

/* ═══ CARD SECTION ═══ */
.af-card {
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  background: #fff;
  box-shadow: 0 2px 12px rgba(15,23,42,.05);
  overflow: hidden;
  height: fit-content;
  transition: box-shadow .2s ease;
}
.af-card:hover { box-shadow: 0 6px 20px rgba(15,23,42,.08); }
.af-card-head {
  background: #f8fafc;
  color: var(--af-primary);
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--af-border);
  display: flex; align-items: center; gap: 8px;
}
.af-card-head i { font-size: 13px; }
.af-card-head.af-accent-success { color: #11998e; }
.af-card-body { padding: 18px; }

/* ═══ FOOTER (cố định dưới) ═══ */
.af-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--af-border);
  border-radius: var(--af-radius);
  box-shadow: 0 -2px 12px rgba(15,23,42,.04);
}
.af-footer-actions { display: flex; gap: 10px; }
.af-footer-left { font-size: 12.5px; color: var(--af-muted); }

/* ═══ INPUTS (gọn, tiết kiệm chiều cao) ═══ */
.af-screen .form-label {
  color: var(--af-text); font-weight: 600;
  font-size: 12.5px; margin-bottom: 4px;
}
.af-screen .form-label .text-danger { color: #ef4444; }
.af-screen .form-control,
.af-screen .form-select,
.af-screen .input-group-text {
  border-radius: 9px;
  border: 1.5px solid var(--af-border);
  font-size: 13.5px;
}
.af-screen .form-control,
.af-screen .form-select {
  padding: 8px 12px;
  min-height: 38px;
}
.af-screen textarea.form-control { min-height: 78px; }
.af-screen .mb-3 { margin-bottom: 12px; }
.af-screen .form-control:focus,
.af-screen .form-select:focus {
  border-color: var(--af-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.af-screen .input-group-text {
  background: #f8fafc; border-right: none; color: var(--af-muted); padding: 8px 11px;
}
.af-screen .input-group .form-control,
.af-screen .input-group .form-select { border-left: none; }
.af-screen .input-group:focus-within .input-group-text {
  border-color: var(--af-primary); color: var(--af-primary);
}

/* ═══ CHECKBOX / SWITCH / DASHED ═══ */
.af-screen .form-check-input {
  width: 17px; height: 17px; border-radius: 5px;
  border: 1.5px solid #cbd5e1; cursor: pointer;
}
.af-screen .form-check-input:checked {
  background-color: var(--af-primary); border-color: var(--af-primary);
}
.af-screen .form-check-label { font-size: 13px; }
.af-screen .border-dashed {
  border: 1.5px dashed #cbd5e1 !important; border-radius: 10px; background: #f8fafc;
}
.af-screen .form-switch .form-check-input { width: 40px; height: 21px; border-radius: 21px; }

/* ═══ BUTTONS ═══ */
.af-screen .btn,
.af-footer .btn, .af-header .btn {
  border-radius: 9px; font-weight: 600; font-size: 13.5px;
  padding: 9px 20px; border: none; transition: filter .15s, transform .1s;
}
.btn-sm { padding: 6px 14px !important; font-size: 12.5px !important; }
.af-screen .btn:active { transform: translateY(1px); }
.af-screen .btn-primary, .af-footer .btn-primary {
  background: var(--af-grad); color: #fff;
  box-shadow: 0 4px 12px rgba(102,126,234,.3);
}
.af-screen .btn-success, .af-footer .btn-success {
  background: var(--af-grad-success); color: #fff;
}
.af-screen .btn-primary:hover, .af-screen .btn-success:hover { filter: brightness(1.06); }
.af-screen .btn-light, .af-footer .btn-light {
  background: #f1f5f9; color: #475569;
}
.af-screen .btn-light:hover { background: #e2e8f0; }

/* ═══ THUMBNAIL UPLOAD ═══ */
.af-thumb {
  border: 2px dashed #cbd5e1; border-radius: 12px;
  background: #f8fafc; padding: 20px; text-align: center;
  color: var(--af-muted); transition: all .2s;
}
.af-thumb:hover { border-color: var(--af-primary); background: #f5f3ff; }
.af-screen input[type="file"].form-control { padding: 6px 10px; }

/* ═══ HELPER TEXT ═══ */
.af-screen .form-text, .af-screen .text-muted.small {
  font-size: 11.5px; color: var(--af-muted);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 992px) {
  .af-body { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .af-screen { height: auto; overflow: visible; padding: 12px; }
  .af-body { overflow: visible; }
  .af-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ═══ Ép style cho widget Django (input không có class form-control) ═══ */
.af-screen input[type="text"],
.af-screen input[type="email"],
.af-screen input[type="password"],
.af-screen input[type="tel"],
.af-screen input[type="number"],
.af-screen input[type="date"],
.af-screen select,
.af-screen textarea {
  border-radius: 9px !important;
  border: 1.5px solid var(--af-border) !important;
  font-size: 13.5px !important;
  padding: 8px 12px !important;
  min-height: 38px !important;
  width: 100%;
  background: #fff;
  color: var(--af-text);
}
.af-screen .input-group input,
.af-screen .input-group select {
  border-radius: 0 9px 9px 0 !important;
  border-left: none !important;
}
.af-screen input:focus,
.af-screen select:focus,
.af-screen textarea:focus {
  border-color: var(--af-primary) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12) !important;
  outline: none;
}
.af-screen textarea { min-height: 78px !important; }
.af-screen .role-checkboxes::-webkit-scrollbar { width: 6px; }
.af-screen .role-checkboxes::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }

/* ═══ CRITICAL FIX: Django widget không có class form-control ═══ */
/* Nhắm vào MỌI input/select/textarea bên trong af-card-body */
.af-card-body input,
.af-card-body select,
.af-card-body textarea {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 8px 12px !important;
  min-height: 38px !important;
  font-size: 13.5px !important;
  line-height: 1.5 !important;
  color: #1e293b !important;
  background: #fff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 9px !important;
  box-sizing: border-box !important;
  transition: border-color .2s ease, box-shadow .2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.af-card-body input:focus,
.af-card-body select:focus,
.af-card-body textarea:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12) !important;
  outline: none !important;
}
.af-card-body textarea {
  min-height: 80px !important;
  resize: vertical;
}
/* Input trong input-group: bỏ border-left + radius trái */
.af-card-body .input-group {
  display: flex !important;
  align-items: stretch !important;
  width: 100% !important;
}
.af-card-body .input-group input,
.af-card-body .input-group select {
  border-left: none !important;
  border-radius: 0 9px 9px 0 !important;
  flex: 1 1 auto !important;
}
.af-card-body .input-group-text {
  display: flex !important;
  align-items: center !important;
  padding: 8px 11px !important;
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
  border-right: none !important;
  border-radius: 9px 0 0 9px !important;
  color: #64748b !important;
  white-space: nowrap !important;
  flex-shrink: 0;
}
/* Select arrow custom */
.af-card-body select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 32px !important;
}
/* row g-2 bên trong af-card-body */
.af-card-body .row { margin: 0 !important; }
.af-card-body .row > [class*="col-"] { padding: 0 6px !important; }

/* ═══ FIX LAYOUT af-body: luôn 2 cột trên màn rộng ═══ */
.af-body {
  grid-template-columns: repeat(2, 1fr) !important;
}
@media (max-width: 1024px) {
  .af-body { grid-template-columns: 1fr !important; }
}

/* ═══ CRITICAL FIX: Django widget — ép 100% width mọi input ═══ */
.af-card-body input,
.af-card-body select,
.af-card-body textarea {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 8px 12px !important;
  min-height: 38px !important;
  font-size: 13.5px !important;
  line-height: 1.5 !important;
  color: #1e293b !important;
  background: #fff !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 9px !important;
  box-sizing: border-box !important;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.af-card-body input:focus,
.af-card-body select:focus,
.af-card-body textarea:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12) !important;
  outline: none !important;
}
.af-card-body textarea { min-height: 80px !important; resize: vertical; }
.af-card-body .input-group {
  display: flex !important;
  align-items: stretch !important;
  width: 100% !important;
}
.af-card-body .input-group input,
.af-card-body .input-group select {
  border-left: none !important;
  border-radius: 0 9px 9px 0 !important;
  flex: 1 1 auto !important;
}
.af-card-body .input-group-text {
  display: flex !important; align-items: center !important;
  padding: 8px 11px !important; background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important; border-right: none !important;
  border-radius: 9px 0 0 9px !important;
  color: #64748b !important; white-space: nowrap !important; flex-shrink: 0;
}
.af-card-body select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 32px !important;
}
.af-card-body .row { margin-left: 0 !important; margin-right: 0 !important; }
.af-card-body .row > [class*="col-"] { padding-left: 6px !important; padding-right: 6px !important; }
.af-body { grid-template-columns: repeat(2, 1fr) !important; }
@media (max-width: 1024px) { .af-body { grid-template-columns: 1fr !important; } }
