:root {
  --navy: #0b3b8c;
  --navy-dark: #07265c;
  --blue: #1d6fe2;
  --blue-soft: #e8f1fd;
  --emerald: #059669;
  --emerald-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --bg: #f4f7fb;
  --white: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--slate-900);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------------- TOAST ---------------- */
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.toast {
  background: var(--slate-900);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  animation: slideIn 0.2s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.info { background: var(--navy); }
@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------------- LOGIN SCREEN ---------------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.22), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(16, 185, 129, 0.18), transparent 40%),
    linear-gradient(135deg, #07265c 0%, #0b3b8c 50%, #1558c0 100%);
}
.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--white);
  border-radius: 18px;
  padding: 32px 28px 26px;
  box-shadow: 0 24px 60px rgba(7, 38, 92, 0.35);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.brand-crest { width: 58px; height: 58px; margin: 0 auto 12px; }
.brand-crest svg { width: 100%; height: 100%; }
.login-brand h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.3px;
}
.login-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--slate-500);
}
.login-form .form-group { margin-bottom: 16px; }
.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute;
  left: 12px;
  font-size: 15px;
  pointer-events: none;
  opacity: 0.7;
}
.input-icon-wrap input { padding-left: 38px; padding-right: 40px; }
.eye-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  opacity: 0.65;
}
.eye-btn:hover { opacity: 1; }
.tos-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--slate-700);
  margin: 14px 0 18px;
  cursor: pointer;
}
.tos-check input { margin-top: 3px; width: 15px; height: 15px; accent-color: var(--blue); }
.login-help {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--slate-100);
  border-radius: 10px;
  font-size: 12px;
  color: var(--slate-700);
  line-height: 1.65;
}
.login-help code {
  background: var(--white);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--slate-200);
  font-weight: 700;
  color: var(--navy);
}
.login-footer {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  text-align: center;
}

/* ---------------- APP SHELL ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 268px;
  background: linear-gradient(180deg, #07265c 0%, #0b3b8c 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform 0.22s ease;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8, #10b981);
  color: #07265c;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-title { font-weight: 800; font-size: 15.5px; letter-spacing: -0.2px; }
.logo-sub { font-size: 11px; color: rgba(255, 255, 255, 0.72); }

.sidebar-user-card {
  margin: 14px 14px 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.user-name { font-weight: 700; font-size: 13.5px; }
.user-meta { font-size: 11.5px; color: rgba(255, 255, 255, 0.78); margin-top: 2px; }
.user-roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.role-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.role-pill.admin { background: #fbbf24; color: #0f172a; }
.role-pill.mgr { background: #34d399; color: #064e3b; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: rgba(255, 255, 255, 0.5);
  padding: 10px 10px 4px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.nav-item.active {
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.nav-item-left { display: flex; align-items: center; gap: 9px; }
.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
}
.nav-item.active .nav-badge { background: var(--blue-soft); color: var(--navy); }

.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.main-wrap {
  flex: 1;
  margin-left: 268px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--slate-200);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--slate-900); }
.page-subtitle { font-size: 12.5px; color: var(--slate-500); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.main-content { padding: 22px 24px 48px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---------------- COMMON UI COMPONENTS ---------------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-title { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--slate-900); }
.card-sub { font-size: 12.5px; color: var(--slate-500); margin-top: 2px; }

/* Form controls */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 5px;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--slate-900);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 111, 226, 0.15);
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy); }
.btn-success { background: var(--emerald); color: #fff; }
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-outline { background: var(--white); border-color: var(--slate-300); color: var(--slate-700); }
.btn-outline:hover:not(:disabled) { background: var(--slate-100); border-color: var(--slate-500); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger-soft { background: rgba(239, 68, 68, 0.16); color: #fecaca; border: none; }
.btn-danger-soft:hover { background: rgba(239, 68, 68, 0.28); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.12); color: #fff; border: none; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.22); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; }
.btn-lg { padding: 11px 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.icon-btn {
  background: var(--slate-100);
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-700);
}
.icon-btn:hover { background: var(--slate-200); }
.sidebar .icon-btn { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-green { background: var(--emerald-soft); color: #065f46; }
.badge-amber { background: var(--amber-soft); color: #92400e; }
.badge-red { background: var(--red-soft); color: #991b1b; }
.badge-blue { background: var(--blue-soft); color: var(--navy); }
.badge-purple { background: var(--purple-soft); color: #5b21b6; }
.badge-gray { background: var(--slate-100); color: var(--slate-700); }

.alert-error {
  background: var(--red-soft);
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 12px;
}
.alert-info {
  background: var(--blue-soft);
  color: var(--navy);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid #bfdbfe;
  margin-bottom: 14px;
}
.alert-warn {
  background: var(--amber-soft);
  color: #92400e;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid #fde68a;
  margin-bottom: 14px;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08); border-color: var(--blue); }
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--blue);
}
.kpi-card.green::before { background: var(--emerald); }
.kpi-card.amber::before { background: var(--amber); }
.kpi-card.red::before { background: var(--red); }
.kpi-card.gray::before { background: var(--slate-500); }
.kpi-card.purple::before { background: var(--purple); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--slate-500); }
.kpi-value { font-size: 27px; font-weight: 800; color: var(--slate-900); margin: 4px 0 2px; }
.kpi-sub { font-size: 12px; color: var(--slate-500); }

/* Progress Bar */
.progress-wrap { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--slate-200);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--blue);
  transition: width 0.25s ease;
}
.progress-fill.green { background: var(--emerald); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }
.progress-pct { font-size: 12px; font-weight: 700; color: var(--slate-700); min-width: 40px; text-align: right; }

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  background: var(--white);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
}
.filter-bar > input, .filter-bar > select { width: auto; min-width: 155px; flex: 1 1 160px; }
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-700);
  background: var(--slate-100);
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
}
.filter-check input { width: 14px; height: 14px; accent-color: var(--blue); }

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 2px solid var(--slate-200);
  margin-bottom: 16px;
  padding-bottom: 6px;
}
.tab-btn {
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-500);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { background: var(--slate-100); color: var(--slate-900); }
.tab-btn.active { background: var(--navy); color: #fff; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--slate-200); }
table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 13px; }
thead th {
  background: #f8fafc;
  color: var(--slate-700);
  font-weight: 700;
  font-size: 12px;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 2px solid var(--slate-200);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
tbody tr:hover { background: #f8fbff; }
tbody tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.chart-box { position: relative; height: 320px; width: 100%; }

/* Profile Hero & Training Sections */
.profile-hero {
  background: linear-gradient(135deg, #07265c 0%, #0b3b8c 55%, #1d6fe2 100%);
  color: #fff;
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.hero-left { display: flex; align-items: center; gap: 16px; flex: 1 1 320px; }
.hero-avatar {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
}
.hero-name { font-size: 20px; font-weight: 800; }
.hero-meta { font-size: 12.5px; color: rgba(255, 255, 255, 0.85); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.hero-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-stat-box {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 118px;
  text-align: center;
}
.hero-stat-val { font-size: 20px; font-weight: 800; }
.hero-stat-lbl { font-size: 11px; opacity: 0.85; }

.info-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.info-pill-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 10px 14px;
}
.info-pill-label { font-size: 11px; color: var(--slate-500); font-weight: 600; text-transform: uppercase; }
.info-pill-val { font-size: 13.5px; font-weight: 700; color: var(--slate-900); margin-top: 2px; }

.score-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 12.5px;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
}
.score-0 { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.score-1 { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.score-2 { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.score-3 { background: #dcfce7; color: #065f46; border: 1px solid #6ee7b7; }
.score-4 { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.score-5 { background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; }

.mgr-code-pill {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  vertical-align: middle;
  white-space: nowrap;
}

/* Section Accordion Card */
.section-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.section-head {
  background: #f8fafc;
  padding: 13px 18px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-head-title { font-size: 14.5px; font-weight: 800; color: var(--navy); }
.section-head-obj { font-size: 12px; color: var(--slate-500); margin-top: 2px; }

/* Score Selector Buttons (0 1 2 3 4 5) */
.score-selector { display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.score-btn {
  width: 31px;
  height: 31px;
  border-radius: 7px;
  border: 1.5px solid var(--slate-300);
  background: var(--white);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--slate-500);
  cursor: pointer;
  transition: all 0.12s;
}
.score-btn:hover { border-color: var(--blue); color: var(--blue); }
.score-btn.active-0 { background: #64748b; border-color: #475569; color: #fff; }
.score-btn.active-1 { background: #ef4444; border-color: #dc2626; color: #fff; }
.score-btn.active-2 { background: #f59e0b; border-color: #d97706; color: #fff; }
.score-btn.active-3 { background: #10b981; border-color: #059669; color: #fff; }
.score-btn.active-4 { background: #2563eb; border-color: #1d4ed8; color: #fff; }
.score-btn.active-5 { background: #7c3aed; border-color: #6d28d9; color: #fff; }

.sticky-save-bar {
  position: sticky;
  bottom: 14px;
  z-index: 80;
  background: var(--navy-dark);
  color: #fff;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(7, 38, 92, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Bulk Action Bar */
.bulk-bar {
  background: var(--blue-soft);
  border: 1px solid #93c5fd;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Program Cards Grid */
.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.program-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
}
.program-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.program-card.empty-prog { border-style: dashed; border-color: #f59e0b; background: #fffdf7; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--slate-700);
}
.pagination-btns { display: flex; gap: 6px; align-items: center; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 660px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--navy); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f8fafc;
}

.loading-box { text-align: center; padding: 48px 16px; color: var(--slate-500); font-weight: 600; }
.empty-state { text-align: center; padding: 36px 20px; color: var(--slate-500); }
.empty-state h4 { margin: 8px 0 4px; color: var(--slate-700); font-size: 15px; }

.mobile-only { display: none; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 150;
}

/* Training Materials (Ảnh, PowerPoint, Excel) */
.mat-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}
.mat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  max-width: 210px;
  line-height: 1.3;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  font-family: inherit;
}
.mat-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}
.mat-pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mat-image { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.mat-ppt   { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.mat-excel { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.mat-pdf   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.mat-word  { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.mat-other { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }

.mat-slot-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #f8fafc;
  color: var(--navy);
  border: 1px dashed #94a3b8;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.mat-slot-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}
.mat-slot-empty {
  color: #64748b;
}

.mat-item-banner {
  background: #f8fbff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.mat-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.mat-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: #fff;
  flex-wrap: wrap;
}
.mat-list-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.mat-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.mat-list-title {
  font-weight: 700;
  color: var(--slate-900);
  font-size: 13px;
  word-break: break-word;
}
.mat-list-sub {
  font-size: 11.5px;
  color: var(--slate-500);
  margin-top: 2px;
}
.mat-list-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.mat-empty-box {
  padding: 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px dashed var(--slate-200);
  color: var(--slate-500);
  font-size: 12.5px;
  text-align: center;
}
.mat-upload-card {
  border-top: 1px solid var(--slate-200);
  padding-top: 14px;
}
.mat-dropzone {
  border: 2px dashed #93c5fd;
  background: #f8fbff;
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.mat-dropzone:hover,
.mat-dropzone.dragover {
  background: #eff6ff;
  border-color: #2563eb;
}
.mat-selected-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.mat-lightbox-wrap {
  text-align: center;
}
.mat-lightbox-img {
  max-width: 100%;
  max-height: 65vh;
  border-radius: 10px;
  border: 1px solid var(--slate-200);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  object-fit: contain;
}
.mat-lightbox-caption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--slate-500);
}

/* Company Intro & Rewards Portal */
.subtab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.subtab-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.subtab-btn:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}
.subtab-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  box-shadow: 0 2px 8px rgba(11, 59, 140, 0.22);
}

.portal-post-card {
  margin-bottom: 16px;
}
.portal-post-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.portal-post-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
}
.portal-post-meta {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 3px;
}
.portal-post-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.portal-post-body {
  color: var(--slate-700);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-line;
  margin-bottom: 10px;
}
.portal-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.portal-img-card {
  padding: 0;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  font-family: inherit;
}
.portal-img-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}
.portal-img-card img {
  width: 100%;
  height: 135px;
  object-fit: cover;
  display: block;
}
.portal-img-cap {
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 6px;
}
.target-pos-scroll {
  max-height: 165px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}
.target-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--slate-700);
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.target-check-item:hover {
  background: #eff6ff;
}
.target-check-item input {
  width: auto;
  margin: 0;
}

.reward-win-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.reward-win-card {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 65%);
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
  padding: 14px 16px;
}
.reward-win-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.reward-win-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}
.reward-win-detail {
  font-size: 13px;
  color: var(--slate-700);
  margin-bottom: 4px;
}
.reward-win-note {
  font-size: 12.5px;
  color: var(--slate-500);
}

/* Responsive */
@media (max-width: 960px) {
  .mobile-only { display: inline-flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .topbar { padding: 12px 14px; }
  .main-content { padding: 14px 12px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .profile-hero { padding: 16px; }
}
