/* =============================================================
   TPS — Premium Light Mode Design System v2.0
   ============================================================= */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800;900&family=Sarabun:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  /* Brand Colors */
  --c-primary:    #4f46e5;
  --c-primary-lt: #eef2ff;
  --c-primary-dk: #3730a3;
  --c-secondary:  #7c3aed;
  --c-accent:     #06b6d4;
  --c-success:    #059669;
  --c-warning:    #d97706;
  --c-danger:     #dc2626;

  /* Gradient Presets */
  --g-brand:   linear-gradient(135deg, #4f46e5, #7c3aed);
  --g-brand2:  linear-gradient(135deg, #4f46e5, #06b6d4);
  --g-warm:    linear-gradient(135deg, #f59e0b, #ef4444);
  --g-cool:    linear-gradient(135deg, #06b6d4, #4f46e5);
  --g-hero:    linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4c1d95 70%, #6d28d9 100%);

  /* Surfaces */
  --s-bg:       #f8fafc;
  --s-bg2:      #f1f5f9;
  --s-card:     #ffffff;
  --s-card2:    #f8fafc;
  --s-border:   #e2e8f0;
  --s-border2:  #cbd5e1;
  --s-hover:    #f1f5f9;

  /* Text */
  --t-ink:      #0f172a;
  --t-body:     #334155;
  --t-muted:    #64748b;
  --t-faint:    #94a3b8;
  --t-inverse:  #f8fafc;

  /* Effects */
  --shadow-sm:  0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.08);
  --shadow-md:  0 4px 16px rgba(15,23,42,.08), 0 2px 8px rgba(15,23,42,.06);
  --shadow-lg:  0 12px 40px rgba(15,23,42,.12), 0 4px 16px rgba(15,23,42,.08);
  --shadow-xl:  0 24px 64px rgba(15,23,42,.16), 0 8px 24px rgba(15,23,42,.10);
  --shadow-glow:0 8px 32px rgba(79,70,229,.24);
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full:9999px;

  /* Transitions */
  --t-fast: .15s cubic-bezier(.4,0,.2,1);
  --t-base: .25s cubic-bezier(.4,0,.2,1);
  --t-slow: .4s  cubic-bezier(.4,0,.2,1);
  --t-spring: .5s cubic-bezier(.34,1.56,.64,1);
}

/* --- Dark Mode Overrides --- */
:root.dark-mode {
  --s-bg:       #0f172a;
  --s-bg2:      #1e293b;
  --s-card:     #1e293b;
  --s-card2:    #0f172a;
  --s-border:   #334155;
  --s-border2:  #475569;
  --s-hover:    #334155;

  --t-ink:      #f8fafc;
  --t-body:     #e2e8f0;
  --t-muted:    #94a3b8;
  --t-faint:    #64748b;
  --t-inverse:  #0f172a;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.5);
  --shadow-xl:  0 24px 64px rgba(0,0,0,.5);
}

:root.dark-mode .nav { background: rgba(30,41,59,.92); }
:root.dark-mode .form-input, :root.dark-mode .db-form input, :root.dark-mode .db-form textarea, :root.dark-mode .db-form select {
  background: #0f172a; color: #f8fafc; border-color: #475569;
}
:root.dark-mode .users-table thead { background: #0f172a; }
:root.dark-mode .users-table td { border-color: #334155; }
:root.dark-mode .btn-white { background: #334155; color: #f8fafc; }
:root.dark-mode .right-panel { background: #0f172a; }

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }
body {
  font-family: 'Sarabun', sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--t-body);
  background: var(--s-bg);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Kanit', sans-serif; color: var(--t-ink); font-weight: 700; line-height: 1.3; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; border: 0; }
input, textarea, select { font-family: inherit; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--s-bg2); }
::-webkit-scrollbar-thumb { background: var(--s-border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--t-faint); }

/* =============================================================
   SHARED COMPONENTS
   ============================================================= */

/* Progress Bar */
.tps-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999; pointer-events: none; }
.tps-progress-fill { height: 100%; width: 0; background: var(--g-brand); transition: width .12s linear; }

/* Badge / Pill */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.badge-primary   { background: var(--c-primary-lt); color: var(--c-primary); }
.badge-brand     { background: var(--g-brand); color: #fff; }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: var(--radius-md); font-size: 14px; font-weight: 600; font-family: 'Sarabun', sans-serif; transition: all var(--t-base); cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--g-brand); color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(79,70,229,.36); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--t-body); border: 1.5px solid var(--s-border); }
.btn-ghost:hover { background: var(--s-hover); border-color: var(--s-border2); }
.btn-white { background: #fff; color: var(--c-primary); box-shadow: var(--shadow-md); }
.btn-white:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-danger { background: #fee2e2; color: #dc2626; border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 15px 32px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: var(--radius-md); }

/* Card */
.card { background: var(--s-card); border: 1px solid var(--s-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-hover { transition: all var(--t-base); }
.card-hover:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: transparent; }

/* Section */
.section { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section-lg { max-width: 1400px; }

/* Divider */
.divider { border: 0; border-top: 1px solid var(--s-border); margin: 24px 0; }

/* =============================================================
   NAVBAR
   ============================================================= */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248,250,252,.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--s-border);
  padding: 0 28px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.nav-brand-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--g-brand);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.nav-brand-text { line-height: 1.2; }
.nav-brand-name { font-family: 'Kanit', sans-serif; font-weight: 800; font-size: 15px; color: var(--t-ink); }
.nav-brand-sub  { font-size: 11px; color: var(--t-muted); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: var(--t-muted);
  transition: all var(--t-fast);
}
.nav-link:hover, .nav-link.active { background: var(--c-primary-lt); color: var(--c-primary); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
@media (max-width: 768px) { .nav-links { display: none; } }

/* =============================================================
   HERO
   ============================================================= */
.hero {
  position: relative; overflow: hidden;
  background: var(--g-hero);
  padding: 100px 28px 140px;
  color: #fff;
}
.hero-mesh {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(99,102,241,.35), transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(124,58,237,.35), transparent 60%),
    radial-gradient(ellipse 40% 40% at 60% 20%, rgba(6,182,212,.2), transparent 50%);
  animation: meshPulse 8s ease-in-out infinite;
}
@keyframes meshPulse { 0%,100%{opacity:1} 50%{opacity:.7} }
.hero-grid {
  position: absolute; inset: 0; z-index: 0; opacity: .05;
  background-image: linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px);
  background-size: 60px 60px;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 860px; margin: 0 auto; text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 18px; border-radius: var(--radius-full);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  backdrop-filter: blur(8px);
  margin-bottom: 24px;
  animation: heroFadeIn .8s .1s both;
}
.hero-badge-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.hero-title {
  font-family: 'Kanit', sans-serif;
  font-weight: 900; font-size: clamp(36px,6vw,72px); line-height: 1.05;
  letter-spacing: -.02em;
  text-shadow: 0 4px 32px rgba(0,0,0,.3);
  animation: heroFadeIn .8s .2s both;
}
.hero-title span {
  background: linear-gradient(90deg, #c7d2fe, #e0e7ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  font-size: 18px; opacity: .85; max-width: 600px; margin: 20px auto 0;
  line-height: 1.8; animation: heroFadeIn .8s .35s both;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 36px; animation: heroFadeIn .8s .5s both; }
.hero-scroll { margin-top: 56px; animation: heroFadeIn .8s .65s both; }
.hero-scroll-inner { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; color: rgba(255,255,255,.5); font-size: 12px; font-weight: 600; }
.hero-scroll-arrow { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; animation: scrollBounce 2s ease-in-out infinite; }
@keyframes heroFadeIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:none} }
@keyframes scrollBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(6px)} }

/* =============================================================
   STATS STRIP
   ============================================================= */
.stats-wrap { max-width: 1200px; margin: -56px auto 0; padding: 0 24px; position: relative; z-index: 5; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  background: var(--s-card); border-radius: var(--radius-xl);
  border: 1px solid var(--s-border); box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.stat-item {
  padding: 32px 24px; text-align: center;
  border-right: 1px solid var(--s-border);
  transition: all var(--t-base);
}
.stat-item:last-child { border-right: 0; }
.stat-item:hover { background: var(--c-primary-lt); }
.stat-icon {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.stat-value {
  font-family: 'Kanit', sans-serif; font-weight: 900; font-size: 40px;
  background: var(--g-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1; margin-bottom: 8px;
}
.stat-label { font-size: 13px; color: var(--t-muted); font-weight: 600; }
@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2,1fr); } .stat-item { border-right: 1px solid var(--s-border); border-bottom: 1px solid var(--s-border); } }

/* =============================================================
   SECTION HEADER
   ============================================================= */
.section-head { text-align: center; margin-bottom: 48px; }
.section-overline { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--c-primary); margin-bottom: 10px; }
.section-title { font-weight: 900; font-size: clamp(26px,4vw,40px); color: var(--t-ink); margin-bottom: 14px; }
.section-sub { font-size: 15px; color: var(--t-muted); max-width: 560px; margin: 0 auto; }

/* =============================================================
   TEACHER CARDS
   ============================================================= */
.teachers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 24px; }
.teacher-card {
  background: var(--s-card); border-radius: var(--radius-xl);
  border: 1px solid var(--s-border); overflow: hidden;
  transition: all var(--t-slow); cursor: pointer; display: block; color: inherit;
  position: relative;
}
.teacher-card::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: var(--g-brand); opacity: 0; transition: opacity var(--t-base);
  border-radius: var(--radius-xl);
}
.teacher-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-xl); border-color: transparent; }
.teacher-card:hover::before { opacity: .04; }
.teacher-cover {
  height: 130px;
  background: var(--g-brand);
  background-size: cover; background-position: center;
  position: relative;
}
.teacher-cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.4));
}
.teacher-avatar-wrap {
  position: absolute; bottom: -44px; left: 50%; transform: translateX(-50%); z-index: 1;
}
.teacher-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  border: 4px solid var(--s-card); box-shadow: var(--shadow-lg);
  background: var(--s-card); overflow: hidden;
}
.teacher-avatar img { width: 100%; height: 100%; object-fit: cover; }
.teacher-avatar-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--g-brand); color: #fff; font-family: 'Kanit',sans-serif;
  font-weight: 800; font-size: 34px;
}
.teacher-body { padding: 56px 22px 22px; text-align: center; position: relative; z-index: 1; }
.teacher-name { font-family: 'Kanit',sans-serif; font-weight: 800; font-size: 17px; color: var(--t-ink); }
.teacher-pos { font-size: 13px; color: var(--t-muted); margin-top: 4px; }
.teacher-dept {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; border-radius: var(--radius-full);
  background: var(--c-primary-lt); color: var(--c-primary);
  font-size: 11px; font-weight: 700; margin-top: 10px;
}
.teacher-stats {
  display: flex; justify-content: center; gap: 0;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--s-border);
}
.teacher-stat { flex: 1; border-right: 1px solid var(--s-border); }
.teacher-stat:last-child { border-right: 0; }
.teacher-stat-num { font-family: 'Kanit',sans-serif; font-weight: 800; font-size: 20px; color: var(--c-primary); }
.teacher-stat-lbl { font-size: 11px; color: var(--t-muted); font-weight: 600; }

/* =============================================================
   FEATURES SECTION
   ============================================================= */
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 20px; max-width: 900px; margin: 0 auto; }
.feature-card {
  background: var(--s-card); border: 1px solid var(--s-border);
  border-radius: var(--radius-lg); padding: 30px 24px;
  transition: all var(--t-base);
}
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: transparent; }
.feature-icon {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,.1);
}
.feature-title { font-family: 'Kanit',sans-serif; font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.feature-desc { font-size: 13px; color: var(--t-muted); line-height: 1.7; }

/* =============================================================
   FOOTER
   ============================================================= */
.footer {
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  color: rgba(255,255,255,.75);
  padding: 64px 28px 32px;
  margin-top: 80px;
  position: relative; overflow: hidden;
}
.footer::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(79,70,229,.15), transparent 70%);
}
.footer-inner { max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }
.footer-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.footer-brand-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--g-brand); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; box-shadow: var(--shadow-glow); }
.footer-name { font-family: 'Kanit',sans-serif; font-weight: 800; font-size: 18px; color: #fff; }
.footer-divider { border: 0; border-top: 1px solid rgba(255,255,255,.08); margin: 28px 0 20px; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 12px; flex-wrap: wrap; gap: 8px; }

/* =============================================================
   REVEAL ANIMATION
   ============================================================= */
.reveal { opacity: 0; transform: translateY(32px); transition: opacity .7s cubic-bezier(.2,.9,.3,1), transform .7s cubic-bezier(.2,.9,.3,1); }
.reveal.shown { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: .1s; }
.reveal-delay-2 { transition-delay: .2s; }
.reveal-delay-3 { transition-delay: .3s; }
.reveal-delay-4 { transition-delay: .4s; }

/* =============================================================
   DASHBOARD — CRUD SECTION (works / trainings / activities)
   ============================================================= */

/* Header row */
.crud-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.crud-title {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Kanit', sans-serif; font-weight: 800; font-size: 17px;
  color: var(--t-ink);
}
.crud-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 8px;
  background: var(--c-primary-lt); color: var(--c-primary);
  border-radius: var(--radius-full); font-size: 12px; font-weight: 700;
}

/* Empty state */
.crud-empty {
  background: var(--s-card); border: 2px dashed var(--s-border2);
  border-radius: var(--radius-lg); padding: 56px 24px;
  text-align: center; color: var(--t-faint);
}
.crud-empty i { font-size: 52px; display: block; margin-bottom: 12px; opacity: .35; }
.crud-empty p  { font-size: 15px; font-weight: 600; margin-bottom: 4px; }

/* List */
.crud-list { display: flex; flex-direction: column; gap: 10px; }
.crud-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--s-card); border: 1px solid var(--s-border);
  border-radius: var(--radius-md); padding: 14px 16px;
  transition: all var(--t-base);
}
.crud-item:hover {
  box-shadow: var(--shadow-md); border-color: #c7d2fe;
  transform: translateY(-2px);
}
.crud-item-thumb {
  width: 60px; height: 60px; border-radius: 10px;
  overflow: hidden; flex-shrink: 0; background: var(--s-bg2);
}
.crud-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.crud-item-icon {
  width: 60px; height: 60px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.crud-item-body { flex: 1; min-width: 0; }
.crud-item-title {
  font-weight: 700; font-size: 14px; color: var(--t-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.crud-item-meta { font-size: 12px; color: var(--t-faint); }
.crud-badge-featured {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; background: #fffbeb; color: #d97706;
  padding: 4px 10px; border-radius: var(--radius-full); font-weight: 700;
  white-space: nowrap; flex-shrink: 0;
}
.crud-item-actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.crud-action-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--s-bg2); color: var(--t-muted);
  border: none; cursor: pointer; font-size: 13px;
  transition: all var(--t-fast); text-decoration: none;
}
.crud-action-btn:hover { background: #e0e7ff; color: var(--c-primary); }
.crud-action-danger:hover { background: #fee2e2; color: #dc2626; }

/* =============================================================
   DASHBOARD — FORM CARD
   ============================================================= */
.form-card {
  background: var(--s-card); border: 1px solid var(--s-border);
  border-radius: var(--radius-lg); padding: 24px;
  max-width: 780px; box-shadow: var(--shadow-sm);
}
.form-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; padding-bottom: 16px;
  border-bottom: 1px solid var(--s-border);
}
.form-card-title {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Kanit', sans-serif; font-weight: 800; font-size: 16px;
  color: var(--t-ink);
}
.form-close-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--s-bg2); color: var(--t-muted);
  font-size: 14px; transition: all var(--t-fast); text-decoration: none;
}
.form-close-btn:hover { background: #fee2e2; color: #dc2626; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; flex-wrap: wrap; }

/* db-form (shared for profile + crud forms) */
.db-form label {
  display: block; font-size: 13px; font-weight: 700;
  color: #334155; margin-bottom: 6px;
}
.db-form input,
.db-form textarea,
.db-form select {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  font-family: 'Sarabun', sans-serif; font-size: 14px;
  color: var(--t-ink); background: #fff; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.db-form input:focus,
.db-form textarea:focus,
.db-form select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.db-form-grid {
  display: grid; grid-template-columns: repeat(2,1fr);
  gap: 14px; margin-bottom: 0;
}
.db-form-grid-3 { grid-template-columns: repeat(3,1fr); }
@media(max-width:640px) {
  .db-form-grid, .db-form-grid-3 { grid-template-columns: 1fr; }
}
.db-form-group { margin-bottom: 14px; }
.db-form-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--t-body);
  cursor: pointer;
}
.db-form-check input[type=checkbox] {
  width: 16px; height: 16px; border-radius: 4px;
  accent-color: var(--c-primary); cursor: pointer;
}

/* btn sizes */
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; }

/* =============================================================
   DASHBOARD — PROFILE TAB
   ============================================================= */
.profile-card {
  background: var(--s-card); border: 1px solid var(--s-border);
  border-radius: var(--radius-lg); padding: 28px;
  max-width: 720px; box-shadow: var(--shadow-sm);
}
.profile-card-title {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Kanit', sans-serif; font-weight: 800; font-size: 17px;
  color: var(--t-ink); margin-bottom: 22px; padding-bottom: 16px;
  border-bottom: 1px solid var(--s-border);
}

/* =============================================================
   DASHBOARD — ADMIN USERS TAB
   ============================================================= */
.users-stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 14px; margin-bottom: 22px;
}
@media(max-width:768px) { .users-stats-grid { grid-template-columns: repeat(2,1fr); } }
.users-stat-card {
  background: var(--s-card); border: 1px solid var(--s-border);
  border-radius: var(--radius-md); padding: 18px 16px; text-align: center;
  transition: all var(--t-base);
}
.users-stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: transparent; }
.users-stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; margin: 0 auto 10px;
}
.users-stat-val {
  font-family: 'Kanit', sans-serif; font-weight: 900; font-size: 28px;
  color: var(--t-ink); line-height: 1;
}
.users-stat-lbl { font-size: 12px; color: var(--t-muted); font-weight: 600; margin-top: 4px; }

/* Table */
.users-table-wrap {
  background: var(--s-card); border: 1px solid var(--s-border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.users-table-scroll { overflow-x: auto; }
.users-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  min-width: 700px;
}
.users-table thead { background: var(--s-bg2); border-bottom: 1px solid var(--s-border); }
.users-table th {
  padding: 13px 18px; font-weight: 700; color: var(--t-muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
}
.users-table td { padding: 13px 18px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover td { background: var(--s-hover); }

.users-user-cell { display: flex; align-items: center; gap: 12px; }
.users-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg,#4f46e5,#7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; overflow: hidden; flex-shrink: 0;
}
.users-avatar img { width: 100%; height: 100%; object-fit: cover; }
.users-name { font-weight: 700; color: var(--t-ink); font-size: 13.5px; }
.users-username { font-size: 11.5px; color: var(--t-faint); margin-top: 2px; }
.users-position { font-size: 13px; color: var(--t-body); font-weight: 600; }
.users-dept { font-size: 11.5px; color: var(--t-faint); margin-top: 2px; }

.users-role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 700;
}
.users-role-badge.admin   { background: #fee2e2; color: #dc2626; }
.users-role-badge.teacher { background: #e0f2fe; color: #0284c7; }
.users-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 700;
}
.users-status-badge.active   { background: #d1fae5; color: #059669; }
.users-status-badge.inactive { background: #f1f5f9; color: #94a3b8; }

.users-stats-mini { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.users-stats-mini span { display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 700; }
.stat-works     { color: #d97706; }
.stat-trainings { color: #059669; }
.stat-activities{ color: #db2777; }
.users-stats-mini small { font-size: 10px; font-weight: 600; color: var(--t-faint); }

.users-actions { display: flex; align-items: center; justify-content: center; gap: 5px; }
.ua-btn {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--s-bg2); color: var(--t-muted);
  border: none; cursor: pointer; font-size: 13px;
  transition: all var(--t-fast); text-decoration: none;
}
.ua-btn:hover  { background: #e0f2fe; color: #0284c7; }
.ua-edit:hover { background: #e0e7ff; color: #4f46e5; }
.ua-delete:hover { background: #fee2e2; color: #dc2626; }

/* =============================================================
   DASHBOARD — SETTINGS TAB
   ============================================================= */
.settings-wrap  { max-width: 800px; }
.settings-form  { display: flex; flex-direction: column; gap: 16px; }
.settings-success {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: var(--radius-md);
  background: #d1fae5; border: 1px solid #6ee7b7;
  color: #065f46; font-weight: 700; font-size: 14px; margin-bottom: 18px;
}
.settings-section {
  background: var(--s-card); border: 1px solid var(--s-border);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.settings-section-head {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--s-border);
}
.settings-section-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
}
.settings-section-title {
  font-family: 'Kanit', sans-serif; font-weight: 800; font-size: 15px;
  color: var(--t-ink); margin-bottom: 2px;
}
.settings-section-sub { font-size: 12px; color: var(--t-muted); }
.settings-submit { padding: 4px 0 16px; }

.sysinfo-grid {
  display: grid; grid-template-columns: repeat(2,1fr); gap: 10px;
}
@media(max-width:640px) { .sysinfo-grid { grid-template-columns: 1fr; } }
.sysinfo-item {
  background: var(--s-bg2); border-radius: var(--radius-md); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sysinfo-label { font-size: 13px; color: var(--t-muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sysinfo-val   { font-size: 13px; font-weight: 700; color: var(--t-ink); }

