/* =====================================================================
   NAFLA — Freight Technology theme (on top of Bootstrap 5.3)
   Brand colors are injected as CSS variables from Admin → Settings.
   ===================================================================== */
:root {
  --nf-navy: #0b1f3a;
  --nf-navy-900: #071428;
  --nf-navy-800: #0e2547;
  --nf-navy-700: #13315c;
  --nf-navy-600: #1d4477;
  --nf-accent: #f59e0b;
  --nf-accent-600: #d97706;
  --nf-teal: #14b8a6;
  --nf-bg: #f3f5f9;
  --nf-surface: #ffffff;
  --nf-border: #e3e8f0;
  --nf-text: #0f172a;
  --nf-muted: #5b6b82;
  --nf-radius: 12px;
  --nf-sidebar-w: 264px;
  --nf-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nf-font-head: "Plus Jakarta Sans", var(--nf-font);
  --nf-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bs-body-font-family: var(--nf-font);
  --bs-body-color: var(--nf-text);
  --bs-border-color: var(--nf-border);
  --bs-primary: var(--nf-navy-700);
  --bs-primary-rgb: 19, 49, 92;
  --bs-link-color: #1d4ed8;
  --bs-link-color-rgb: 29, 78, 216;
  --bs-link-hover-color: #1e3a8a;
  --bs-border-radius: 10px;
}

body { font-family: var(--nf-font); background: var(--nf-bg); color: var(--nf-text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .display-5, .display-6 { font-family: var(--nf-font-head); font-weight: 700; letter-spacing: -0.01em; color: var(--nf-navy); }
.mono, code.mono { font-family: var(--nf-font-mono); font-size: .875em; }
.text-muted, .text-secondary { color: var(--nf-muted) !important; }
a { text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }

/* Accessibility: strong, consistent focus states */
:focus-visible { outline: 3px solid var(--nf-accent) !important; outline-offset: 2px; box-shadow: none !important; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 2000; background: var(--nf-accent); color: var(--nf-navy); padding: 8px 14px; border-radius: 6px; font-weight: 700; }
.skip-link:focus { left: 8px; }
.visually-hidden-focusable:focus { position: static !important; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: 9px; }
.btn-primary { --bs-btn-bg: var(--nf-navy-700); --bs-btn-border-color: var(--nf-navy-700); --bs-btn-hover-bg: var(--nf-navy); --bs-btn-hover-border-color: var(--nf-navy); --bs-btn-active-bg: var(--nf-navy-900); --bs-btn-disabled-bg: var(--nf-navy-600); --bs-btn-disabled-border-color: var(--nf-navy-600); }
.btn-accent { --bs-btn-color: var(--nf-navy-900); --bs-btn-bg: var(--nf-accent); --bs-btn-border-color: var(--nf-accent); --bs-btn-hover-color: var(--nf-navy-900); --bs-btn-hover-bg: #fbbf24; --bs-btn-hover-border-color: #fbbf24; --bs-btn-active-bg: var(--nf-accent-600); --bs-btn-active-color: var(--nf-navy-900); }
.btn-outline-primary { --bs-btn-color: var(--nf-navy-700); --bs-btn-border-color: var(--nf-navy-700); --bs-btn-hover-bg: var(--nf-navy-700); --bs-btn-hover-border-color: var(--nf-navy-700); --bs-btn-active-bg: var(--nf-navy); }
.btn-outline-light-soft { color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-outline-light-soft:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; }

/* ---------- Cards & surfaces ---------- */
.card { --bs-card-bg: var(--nf-surface); background: var(--nf-surface); border: 1px solid var(--nf-border); border-radius: var(--nf-radius); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--nf-border); font-weight: 700; padding: .9rem 1.1rem; }
.card-body { padding: 1.1rem; }
.card-hover { transition: transform .15s ease, box-shadow .15s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(11,31,58,.10); }
.surface-navy { background: var(--nf-navy); color: #e5edf8; }
.surface-navy h1, .surface-navy h2, .surface-navy h3, .surface-navy h4, .surface-navy h5 { color: #fff; }
.border-dashed { border-style: dashed !important; }

.stat-card { display: flex; flex-direction: row; gap: .9rem; align-items: center; padding: 1rem 1.1rem; height: 100%; }
.stat-card .stat-icon { flex: 0 0 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: #eef3fb; color: var(--nf-navy-700); }
.stat-card .stat-icon.accent { background: #fff4e0; color: #b45309; }
.stat-card .stat-icon.teal { background: #e0f7f4; color: #0f766e; }
.stat-card .stat-icon.violet { background: #efeafe; color: #6d28d9; }
.stat-card .stat-icon.red { background: #fde8e8; color: #b91c1c; }
.stat-card .stat-icon.green { background: #e3f6ea; color: #15803d; }
.stat-card .stat-value { font-family: var(--nf-font-head); font-size: 1.45rem; font-weight: 800; color: var(--nf-navy); line-height: 1.1; }
.stat-card .stat-label { color: var(--nf-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.progress { height: .55rem; background: #e8edf5; border-radius: 99px; }
.progress-bar { background: linear-gradient(90deg, var(--nf-teal), #22c55e); border-radius: 99px; }
.progress.progress-lg { height: .8rem; }

.badge { font-weight: 600; letter-spacing: .01em; }
.status-badge { font-size: .72rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 99px; background: #eef3fb; color: var(--nf-navy-700); font-size: .78rem; font-weight: 600; }
.chip-accent { background: #fff4e0; color: #92400e; }
.chip-teal { background: #e0f7f4; color: #0f766e; }

.table { --bs-table-bg: transparent; vertical-align: middle; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--nf-muted); font-weight: 700; border-bottom-width: 1px; white-space: nowrap; }
.table-card { margin-bottom: 0; }
.table-card td, .table-card th { padding: .7rem 1rem; }

.form-label { font-weight: 600; font-size: .88rem; color: #1e293b; }
.form-control, .form-select { border-radius: 9px; border-color: #d5dde8; }
.form-control:focus, .form-select:focus { border-color: var(--nf-navy-600); box-shadow: 0 0 0 .2rem rgba(19,49,92,.15); }
.form-text { color: var(--nf-muted); }

/* ---------- App shell (sidebar + topbar) ---------- */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--nf-sidebar-w); background: var(--nf-navy-900); color: #b6c3d8; display: flex; flex-direction: column; z-index: 1040; border-right: 1px solid rgba(255,255,255,.05); }
.sidebar .brand { display: flex; align-items: center; gap: .65rem; padding: 1.05rem 1.2rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--nf-accent), #fbbf24); color: var(--nf-navy-900); display: grid; place-items: center; font-weight: 900; font-family: var(--nf-font-head); font-size: .95rem; flex: 0 0 36px; }
.brand-text { line-height: 1.1; }
.brand-text strong { display: block; font-family: var(--nf-font-head); font-size: 1rem; letter-spacing: .02em; }
.brand-text small { color: #8ea0bb; font-size: .7rem; }
.sidebar-nav { overflow-y: auto; padding: .6rem .6rem 1.5rem; flex: 1; scrollbar-width: thin; scrollbar-color: #24406b transparent; }
.sidebar-nav .nav-heading { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #6b7f9e; padding: 1rem .75rem .35rem; font-weight: 700; }
.sidebar-nav a { display: flex; align-items: center; gap: .7rem; color: #c3cfe2; padding: .5rem .75rem; border-radius: 9px; text-decoration: none; font-size: .9rem; font-weight: 500; border-left: 3px solid transparent; }
.sidebar-nav a i { font-size: 1.05rem; opacity: .85; width: 1.2rem; text-align: center; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: rgba(245,158,11,.12); color: #fff; border-left-color: var(--nf-accent); }
.sidebar-nav a.active i { color: var(--nf-accent); opacity: 1; }
.sidebar-footer { padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.06); font-size: .75rem; color: #6b7f9e; }
.area-switch { display: flex; gap: .35rem; padding: .7rem .9rem 0; flex-wrap: wrap; }
.area-switch a { font-size: .72rem; padding: .2rem .55rem; border-radius: 99px; background: rgba(255,255,255,.06); color: #c3cfe2; text-decoration: none; }
.area-switch a.active { background: var(--nf-accent); color: var(--nf-navy-900); font-weight: 700; }

.main { margin-left: var(--nf-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--nf-border); display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; min-height: 62px; }
.topbar .search-wrap { position: relative; flex: 1; max-width: 560px; }
.topbar .search-wrap .form-control { padding-left: 2.3rem; background: #f4f6fa; border-color: transparent; }
.topbar .search-wrap .form-control:focus { background: #fff; border-color: var(--nf-navy-600); }
.topbar .search-wrap > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--nf-muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--nf-border); border-radius: 12px; box-shadow: 0 18px 40px rgba(11,31,58,.16); max-height: 70vh; overflow-y: auto; z-index: 1050; }
.search-results .sr-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--nf-muted); padding: .6rem .9rem .25rem; font-weight: 700; }
.search-results a { display: block; padding: .45rem .9rem; color: var(--nf-text); text-decoration: none; }
.search-results a:hover, .search-results a.active { background: #f1f5fb; }
.search-results a small { display: block; color: var(--nf-muted); font-size: .78rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--nf-navy-700); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; flex: 0 0 36px; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; flex-basis: 64px; }
.notif-dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; }
.notif-menu { width: 360px; max-width: 92vw; }
.notif-item { white-space: normal; border-bottom: 1px solid #f1f4f8; }
.notif-item.unread { background: #f7faff; }
.content { padding: 1.5rem 1.25rem 2.5rem; flex: 1; }
.content-narrow { max-width: 1080px; }
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.55rem; margin: 0; }
.page-header .subtitle { color: var(--nf-muted); margin: .25rem 0 0; }
.breadcrumb { font-size: .8rem; margin-bottom: .3rem; }
.app-footer { padding: 1rem 1.25rem; color: var(--nf-muted); font-size: .78rem; border-top: 1px solid var(--nf-border); background: #fff; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(7,20,40,.45); z-index: 1035; }
  .main { margin-left: 0; }
  .content { padding: 1.1rem 1rem 2rem; }
}
@media (max-width: 575.98px) {
  .topbar { padding: .5rem .75rem; gap: .5rem; }
  .page-header h1 { font-size: 1.3rem; }
  .stat-card .stat-value { font-size: 1.2rem; }
}

/* ---------- Public site ---------- */
.public-nav { background: var(--nf-navy-900); }
.public-nav .navbar-brand { display: flex; align-items: center; gap: .6rem; color: #fff; }
.public-nav .nav-link { color: #c9d5e8; font-weight: 500; font-size: .92rem; }
.public-nav .nav-link:hover, .public-nav .nav-link.active { color: #fff; }
.public-nav .navbar-toggler { border-color: rgba(255,255,255,.25); }
.public-nav .navbar-toggler-icon { filter: invert(1); }

.hero { position: relative; overflow: hidden; background: radial-gradient(1100px 500px at 85% -10%, rgba(20,184,166,.22), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(245,158,11,.18), transparent 60%), linear-gradient(160deg, var(--nf-navy-900), var(--nf-navy) 55%, var(--nf-navy-800)); color: #dbe5f3; padding: 5.5rem 0 4.5rem; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 85%); pointer-events: none; }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 800; line-height: 1.05; }
.hero .lead { color: #c3d0e4; font-size: clamp(1rem, 2vw, 1.2rem); max-width: 640px; }
.hero .eyebrow { display: inline-flex; gap: .5rem; align-items: center; padding: .35rem .8rem; border-radius: 99px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); font-size: .8rem; color: #e2e8f0; }
.hero-console { background: rgba(7,20,40,.75); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; box-shadow: 0 30px 60px rgba(0,0,0,.35); overflow: hidden; }
.hero-console .console-bar { display: flex; align-items: center; gap: .4rem; padding: .6rem .9rem; border-bottom: 1px solid rgba(255,255,255,.08); font-size: .75rem; color: #8ea0bb; }
.hero-console .console-bar span.dot { width: 9px; height: 9px; border-radius: 50%; background: #334a6e; }
.hero-console table { color: #dbe5f3; font-size: .8rem; margin: 0; }
.hero-console table td, .hero-console table th { border-color: rgba(255,255,255,.06); padding: .5rem .7rem; background: transparent; color: inherit; }
.hero-console .rpm-good { color: #34d399; font-weight: 700; }
.hero-console .rpm-bad { color: #f87171; font-weight: 700; }

.section { padding: 4.5rem 0; }
.section-sm { padding: 3rem 0; }
.section-title { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 800; }
.section-eyebrow { color: var(--nf-accent-600); text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: .78rem; }
.section-alt { background: #fff; border-top: 1px solid var(--nf-border); border-bottom: 1px solid var(--nf-border); }
.feature-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; background: #eef3fb; color: var(--nf-navy-700); }
.journey { counter-reset: lvl; }
.journey-step { position: relative; padding: .9rem 1rem .9rem 3.4rem; border: 1px solid var(--nf-border); border-radius: 12px; background: #fff; height: 100%; }
.journey-step::before { counter-increment: lvl; content: counter(lvl); position: absolute; left: .9rem; top: .9rem; width: 30px; height: 30px; border-radius: 9px; background: var(--nf-navy); color: var(--nf-accent); font-weight: 800; display: grid; place-items: center; font-family: var(--nf-font-head); }
.journey-step.final::before { content: "★"; background: var(--nf-accent); color: var(--nf-navy); }
.workflow { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.workflow .wf-node { background: #fff; border: 1px solid var(--nf-border); border-radius: 10px; padding: .45rem .75rem; font-weight: 600; font-size: .85rem; color: var(--nf-navy); }
.workflow .wf-arrow { color: var(--nf-accent-600); }
.cta-band { background: linear-gradient(120deg, var(--nf-navy), var(--nf-navy-700)); color: #dbe5f3; border-radius: 20px; padding: 3rem 2rem; position: relative; overflow: hidden; }
.cta-band h2 { color: #fff; }
.public-footer { background: var(--nf-navy-900); color: #93a4bf; font-size: .9rem; }
.public-footer a { color: #c3cfe2; text-decoration: none; }
.public-footer a:hover { color: #fff; }
.public-footer h6 { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.legal-strip { border-top: 1px solid rgba(255,255,255,.08); font-size: .78rem; color: #7c8da8; }

.course-card .thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--nf-navy-700), var(--nf-navy-900)); border-radius: var(--nf-radius) var(--nf-radius) 0 0; position: relative; overflow: hidden; display: grid; place-items: center; color: rgba(255,255,255,.9); }
.course-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-card .thumb .lvl { position: absolute; top: .7rem; left: .7rem; background: var(--nf-accent); color: var(--nf-navy-900); font-weight: 800; font-size: .72rem; padding: .2rem .55rem; border-radius: 6px; }
.course-card .thumb i { font-size: 2.6rem; opacity: .9; }
.course-card .thumb::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 22px 22px; }
.course-card .card-title { font-size: 1rem; }
.price { font-family: var(--nf-font-head); font-weight: 800; color: var(--nf-navy); }
.price del { color: var(--nf-muted); font-weight: 500; font-size: .85em; margin-left: .3rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside { background: linear-gradient(160deg, var(--nf-navy-900), var(--nf-navy)); color: #c9d5e8; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 40px 40px; }
.auth-aside > * { position: relative; }
.auth-aside h2 { color: #fff; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: #fff; }
.auth-card { width: 100%; max-width: 430px; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ---------- Lesson / course player ---------- */
.course-outline .module-title { font-weight: 700; font-size: .9rem; color: var(--nf-navy); }
.course-outline .lesson-link { display: flex; gap: .55rem; align-items: flex-start; padding: .45rem .6rem; border-radius: 8px; color: var(--nf-text); text-decoration: none; font-size: .87rem; }
.course-outline .lesson-link:hover { background: #f1f5fb; }
.course-outline .lesson-link.active { background: #eaf1fc; font-weight: 600; }
.course-outline .lesson-link .state { flex: 0 0 18px; margin-top: 2px; }
.lesson-content { font-size: 1.02rem; line-height: 1.75; color: #1e293b; }
.lesson-content h2 { font-size: 1.35rem; margin-top: 1.8rem; }
.lesson-content h3 { font-size: 1.12rem; margin-top: 1.4rem; }
.lesson-content table { width: 100%; margin: 1rem 0; border-collapse: collapse; font-size: .92rem; }
.lesson-content table th, .lesson-content table td { border: 1px solid var(--nf-border); padding: .5rem .65rem; }
.lesson-content table th { background: #f4f7fb; }
.lesson-content .callout { border-left: 4px solid var(--nf-teal); background: #effbf9; padding: .8rem 1rem; border-radius: 0 10px 10px 0; margin: 1rem 0; }
.lesson-content .callout.warn { border-left-color: var(--nf-accent); background: #fff8eb; }
.lesson-content .callout.danger { border-left-color: #ef4444; background: #fef2f2; }
.lesson-content .formula { font-family: var(--nf-font-mono); background: var(--nf-navy); color: #e2e8f0; padding: .7rem 1rem; border-radius: 10px; display: block; margin: .8rem 0; font-size: .9rem; }
.objective-list li { margin-bottom: .35rem; }
.compliance-banner { border: 1px solid #fcd34d; background: #fffbeb; border-radius: 12px; padding: .8rem 1rem; font-size: .9rem; }
.compliance-banner.overdue { border-color: #fca5a5; background: #fef2f2; }
.video-frame { aspect-ratio: 16/9; width: 100%; border-radius: 12px; overflow: hidden; background: #000; }
.video-frame iframe, .video-frame video { width: 100%; height: 100%; border: 0; }

/* ---------- Quiz ---------- */
.quiz-question { border: 1px solid var(--nf-border); border-radius: 12px; padding: 1.1rem; background: #fff; margin-bottom: 1rem; }
.quiz-question .qnum { font-family: var(--nf-font-mono); color: var(--nf-muted); font-size: .78rem; }
.quiz-option { display: flex; gap: .65rem; align-items: flex-start; padding: .6rem .8rem; border: 1px solid var(--nf-border); border-radius: 10px; margin-bottom: .5rem; cursor: pointer; }
.quiz-option:hover { background: #f7f9fc; }
.quiz-option input { margin-top: .25rem; }
.quiz-option.correct { border-color: #22c55e; background: #f0fdf4; }
.quiz-option.incorrect { border-color: #ef4444; background: #fef2f2; }
.quiz-timer { position: sticky; top: 72px; z-index: 5; }
.scenario-box { background: #f4f7fb; border-left: 4px solid var(--nf-navy-600); padding: .75rem 1rem; border-radius: 0 10px 10px 0; margin-bottom: .8rem; font-size: .93rem; }

/* ---------- Simulators ---------- */
.sim-card .sim-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: linear-gradient(135deg, var(--nf-navy-700), var(--nf-navy)); color: var(--nf-accent); }
.route { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.route .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--nf-navy-600); flex: 0 0 10px; }
.route .dot.dest { background: var(--nf-accent); border-color: var(--nf-accent); }
.route .line { flex: 1; border-top: 2px dashed #b9c5d6; min-width: 18px; }
.load-row.shortlisted { background: #fffbeb; }
#lbTable td, #lbTable th { padding: .45rem .55rem; }
.rpm-chip { font-family: var(--nf-font-mono); font-weight: 700; }
.rpm-chip.good { color: #15803d; }
.rpm-chip.ok { color: #b45309; }
.rpm-chip.bad { color: #b91c1c; }
.sim-dialogue { max-height: 460px; overflow-y: auto; padding: 1rem; background: #f7f9fc; border-radius: 12px; }
.bubble { max-width: 85%; padding: .65rem .9rem; border-radius: 14px; margin-bottom: .6rem; font-size: .93rem; line-height: 1.5; }
.bubble.them { background: #fff; border: 1px solid var(--nf-border); border-bottom-left-radius: 4px; }
.bubble.me { background: var(--nf-navy-700); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble .who { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; font-weight: 700; margin-bottom: .15rem; }
.bubble.system { background: #fff8eb; border: 1px dashed #f59e0b; max-width: 100%; font-size: .85rem; }
.choice-btn { text-align: left; white-space: normal; }
.feedback-good { color: #15803d; }
.feedback-bad { color: #b91c1c; }
.stepper { display: flex; flex-wrap: wrap; gap: .35rem; }
.stepper .step { font-size: .72rem; padding: .25rem .55rem; border-radius: 99px; background: #e8edf5; color: var(--nf-muted); font-weight: 600; }
.stepper .step.done { background: #dcfce7; color: #166534; }
.stepper .step.current { background: var(--nf-accent); color: var(--nf-navy-900); }
.score-ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--nf-teal) calc(var(--p) * 1%), #e8edf5 0); display: grid; place-items: center; margin: auto; }
.score-ring > div { width: 92px; height: 92px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-family: var(--nf-font-head); font-weight: 800; font-size: 1.5rem; color: var(--nf-navy); }

/* HOS / ELD log grid */
.eld-grid { position: relative; width: 100%; overflow-x: auto; }
.eld-grid svg { min-width: 680px; width: 100%; height: auto; display: block; }
.eld-clock { font-family: var(--nf-font-mono); font-size: 1.6rem; font-weight: 700; color: var(--nf-navy); }
.duty-pill { padding: .2rem .55rem; border-radius: 6px; font-size: .75rem; font-weight: 700; color: #fff; }
.duty-off { background: #64748b; } .duty-sb { background: #6366f1; } .duty-d { background: #16a34a; } .duty-on { background: #f59e0b; color: #1f2937; } .duty-pc { background: #0ea5e9; } .duty-ym { background: #a855f7; }

/* CRM kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col { background: #eef2f8; border-radius: 12px; padding: .6rem; min-height: 200px; }
.kanban-col h6 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nf-muted); display: flex; justify-content: space-between; }
.kanban-card { background: #fff; border: 1px solid var(--nf-border); border-radius: 10px; padding: .6rem .7rem; margin-bottom: .5rem; font-size: .85rem; }

/* Certificates */
.cert-preview { aspect-ratio: 1.414/1; border: 10px solid var(--nf-navy); outline: 2px solid var(--nf-accent); outline-offset: -18px; background: #fffdf8; padding: 2.2rem; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.verify-result { border-radius: 16px; padding: 1.5rem; }
.verify-result.valid { background: #f0fdf4; border: 1px solid #86efac; }
.verify-result.invalid { background: #fef2f2; border: 1px solid #fca5a5; }

/* Utilities */
.min-w-0 { min-width: 0; }
.fs-7 { font-size: .85rem; }
.fs-8 { font-size: .75rem; }
.fw-800 { font-weight: 800; }
.text-navy { color: var(--nf-navy) !important; }
.text-accent { color: var(--nf-accent-600) !important; }
.bg-navy { background: var(--nf-navy) !important; }
.bg-soft { background: #f4f7fb !important; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--nf-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; color: #a3b1c6; }
.disclaimer { font-size: .8rem; color: var(--nf-muted); border-top: 1px dashed var(--nf-border); padding-top: .6rem; }
.table-responsive { border-radius: 0 0 var(--nf-radius) var(--nf-radius); }
.sticky-side { position: sticky; top: 80px; }
.cursor-pointer { cursor: pointer; }
.list-check { list-style: none; padding-left: 0; }
.list-check li { position: relative; padding-left: 1.6rem; margin-bottom: .4rem; }
.list-check li::before { content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; left: 0; top: 0; color: var(--nf-teal); font-weight: 700; }
.training-watermark { border: 2px dashed #dc2626; color: #b91c1c; font-weight: 800; letter-spacing: .05em; text-align: center; padding: .4rem; border-radius: 8px; font-size: .85rem; background: #fef2f2; }
@media print { .sidebar, .topbar, .app-footer, .no-print { display: none !important; } .main { margin: 0; } }

/* ---------- SOPs, knowledge center, career ---------- */
.sop-steps { counter-reset: step; list-style: none; padding-left: 0; }
.sop-steps li { counter-increment: step; position: relative; padding: .7rem .9rem .7rem 3.1rem; border: 1px solid var(--nf-border); border-radius: 10px; margin-bottom: .55rem; background: #fff; }
.sop-steps li::before { content: counter(step); position: absolute; left: .8rem; top: .65rem; width: 26px; height: 26px; border-radius: 8px; background: var(--nf-navy); color: #fff; font-weight: 700; font-size: .8rem; display: grid; place-items: center; }
.post-card .post-type { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--nf-accent-600); }
.article-body { font-size: 1.05rem; line-height: 1.8; color: #1e293b; max-width: 72ch; }
.article-body h2 { font-size: 1.35rem; margin-top: 2rem; }
.article-body ul, .article-body ol { padding-left: 1.3rem; }
.tag-chip { display: inline-block; padding: .2rem .6rem; border-radius: 99px; background: #eef3fb; color: var(--nf-navy-700); font-size: .78rem; text-decoration: none; margin: 0 .25rem .35rem 0; }
.tag-chip:hover, .tag-chip.active { background: var(--nf-navy); color: #fff; }
.roadmap { position: relative; padding-left: 1.6rem; border-left: 3px solid var(--nf-border); }
.roadmap-stage { position: relative; margin-bottom: 1.4rem; }
.roadmap-stage::before { content: ""; position: absolute; left: -2.18rem; top: .3rem; width: 16px; height: 16px; border-radius: 50%; background: var(--nf-accent); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--nf-accent); }
.resume-sheet { background: #fff; max-width: 820px; margin: 0 auto; padding: 2.5rem; border: 1px solid var(--nf-border); border-radius: 8px; font-size: .95rem; }
.resume-sheet h1 { font-size: 1.7rem; margin-bottom: .2rem; }
.resume-sheet h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--nf-navy-700); border-bottom: 2px solid var(--nf-navy); padding-bottom: .25rem; margin-top: 1.4rem; }
@media print {
  .sidebar, .topbar, .app-footer, .public-nav, .public-footer, .page-header .breadcrumb, .page-header > .d-flex, .no-print, .skip-link, .alert { display: none !important; }
  .main, .content { margin: 0 !important; padding: 0 !important; }
  .resume-sheet { border: 0; padding: 0; }
  body { background: #fff !important; }
}

/* ---------- AI study assistant ---------- */
.chat-log { height: min(62vh, 640px); overflow-y: auto; display: flex; flex-direction: column; gap: .8rem; background: #f8fafc; }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble { max-width: min(760px, 92%); padding: .75rem 1rem; border-radius: 14px; font-size: .95rem; line-height: 1.6; overflow-wrap: anywhere; }
.chat-msg.user .chat-bubble { background: var(--nf-navy); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.bot .chat-bubble { background: #fff; border: 1px solid var(--nf-border); border-bottom-left-radius: 4px; }
.chat-msg.error .chat-bubble { border-color: #fca5a5; background: #fef2f2; }
.chat-bubble .cite { font-weight: 700; text-decoration: none; }
.chat-sources { padding-left: 1.2rem; border-top: 1px solid var(--nf-border); padding-top: .5rem; }
.chat-escalation { border: 1px solid #fcd34d; background: #fffbeb; border-radius: 10px; padding: .6rem .8rem; }
.chat-meta { font-size: .72rem; color: var(--nf-muted); margin-top: .4rem; }
.chat-typing { display: inline-flex; gap: 4px; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: chatdot 1s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .15s; } .chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatdot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .chat-typing span { animation: none; } }
.chat-history { max-height: 60vh; overflow-y: auto; }

/* Flex/grid children default to min-width:auto, which lets wide tables stretch the page instead of scrolling in their card. */
.main, .content, .content .row > *, .card, .card-body { min-width: 0; }
/* Absolutely positioned descendants (e.g. .visually-hidden labels) must be clipped by the scroll container. */
.table-responsive { position: relative; }

/* ---------- Protected course material (see public/assets/js/protect.js) ---------- */
.secure-player .video-frame { position: relative; }
.secure-player .video-frame:fullscreen { aspect-ratio: auto; border-radius: 0; display: flex; align-items: center; }
.player-wm { position: absolute; z-index: 2; pointer-events: none; user-select: none; color: rgba(255,255,255,.42); text-shadow: 0 1px 2px rgba(0,0,0,.55); font-size: clamp(10px, 1.4vw, 15px); font-weight: 600; white-space: nowrap; transition: top 1.2s ease, left 1.2s ease; }
.player-msg { position: absolute; inset: auto 0 0 0; z-index: 3; margin: 12px; padding: 10px 14px; border-radius: 8px; background: rgba(11,31,58,.92); color: #fff; font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
body[data-protect] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body[data-protect] :is(input, textarea, select, [contenteditable="true"], .allow-copy) { -webkit-user-select: text; user-select: text; }
body[data-protect] img, body[data-protect] video, body[data-protect] canvas { -webkit-user-drag: none; }
.page-wm { position: fixed; inset: 0; z-index: 1080; pointer-events: none; background-repeat: repeat; }
.lesson-figure { position: relative; }
.protected-doc { position: relative; }
.protected-doc canvas { display: block; width: 100%; height: auto; margin: 0 auto 1rem; box-shadow: 0 2px 10px rgba(15,23,42,.12); background: #fff; }
.protected-doc .doc-wm { position: absolute; inset: 0; pointer-events: none; background-repeat: repeat; }
@media print {
  body[data-protect] * { display: none !important; }
  body[data-protect]::before { content: "Printing course material is disabled."; display: block !important; padding: 2rem; font: 16px sans-serif; }
}

/* ------------------------------------------------------------------ Study Hub (Phase 17) */
.goal-ring { flex: none; transform: rotate(-90deg); }
.goal-ring circle { fill: none; stroke-width: 9; }
.goal-ring-track { stroke: var(--nf-border); }
.goal-ring-value { stroke: var(--nf-accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.goal-ring text { transform: rotate(90deg); transform-origin: 50px 50px; fill: var(--nf-text); }
.goal-ring-num { font: 700 24px var(--nf-font-head); }
.goal-ring-unit { font-size: 10px; fill: var(--nf-muted) !important; }

.heatmap { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.heatmap-days { display: grid; grid-template-rows: repeat(7, 14px); gap: 4px; margin-right: 4px; font-size: 10px; line-height: 14px; }
.heatmap-col { display: grid; grid-template-rows: repeat(7, 14px); gap: 4px; }
.hm { display: inline-block; width: 14px; height: 14px; border-radius: 3px; background: #e8edf4; }
.hm.l1 { background: #bfe9e3; } .hm.l2 { background: #6fd3c5; } .hm.l3 { background: #14b8a6; } .hm.l4 { background: #0b7d71; }
.hm.lx { background: transparent; border: 1px dashed var(--nf-border); }
.heatmap-legend { display: inline-flex; align-items: center; gap: 3px; }
.heatmap-legend .hm { width: 11px; height: 11px; }

.fc-card { perspective: 1400px; height: 320px; cursor: pointer; outline: none; }
.fc-card:focus-visible .fc-face { box-shadow: 0 0 0 3px rgba(245, 158, 11, .5); }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .45s ease; transform-style: preserve-3d; }
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; padding: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--nf-border); background: var(--nf-surface); box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
.fc-front { background: linear-gradient(145deg, var(--nf-navy-800), var(--nf-navy-600)); color: #fff; border: 0; }
.fc-back { transform: rotateY(180deg); }
.fc-term { font: 700 clamp(1.5rem, 4vw, 2.2rem)/1.2 var(--nf-font-head); }
.fc-term-sm { font: 700 1rem var(--nf-font-head); color: var(--nf-accent-600); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .75rem; }
.fc-def { font-size: clamp(1.05rem, 2.6vw, 1.3rem); line-height: 1.5; max-width: 560px; }
.fc-src { position: absolute; bottom: 1rem; font-size: .8rem; color: var(--nf-muted); }
.fc-hint { position: absolute; bottom: 1rem; font-size: .8rem; color: #b6c3d8; }
.fc-hint kbd { background: rgba(255, 255, 255, .15); }
.fc-tag { position: absolute; top: 1rem; left: 1rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; background: var(--nf-accent); color: #111; border-radius: 99px; padding: .15rem .6rem; }
.fc-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.fc-btn { display: flex; flex-direction: column; align-items: center; padding: .6rem .25rem; font-weight: 600; border: 1px solid var(--nf-border); background: var(--nf-surface); }
.fc-btn small { font-size: .7rem; color: var(--nf-muted); font-weight: 400; }
.fc-again { border-bottom: 3px solid #dc2626; } .fc-hard { border-bottom: 3px solid #d97706; }
.fc-good { border-bottom: 3px solid #16a34a; } .fc-easy { border-bottom: 3px solid #2563eb; }
.fc-btn:hover { background: var(--nf-bg); }

.player-chapters { margin-top: .5rem; border: 1px solid var(--nf-border); border-radius: 10px; background: var(--nf-surface); }
.player-chapters summary { padding: .5rem .75rem; font-weight: 600; font-size: .9rem; cursor: pointer; }
.player-chapters ol { list-style: none; margin: 0; padding: 0 .35rem .35rem; max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); column-gap: .5rem; }
.player-chapters li { min-width: 0; }
.player-chapters button { display: flex; gap: .6rem; width: 100%; text-align: left; border: 0; background: none; padding: .35rem .5rem; border-radius: 6px; font-size: .875rem; color: var(--nf-text); }
.player-chapters button:hover { background: var(--nf-bg); }
.player-chapters button.active { background: rgba(245, 158, 11, .14); font-weight: 600; }
.ch-time { color: var(--nf-muted); min-width: 2.8rem; font-size: .8rem; padding-top: .1rem; }

.notes-panel textarea { min-height: 140px; resize: vertical; }
.note-body { white-space: normal; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Discovery pages (Phase 17) */
.page-hero { position: relative; background: radial-gradient(900px 400px at 90% -20%, rgba(20,184,166,.2), transparent 60%), linear-gradient(160deg, var(--nf-navy-900), var(--nf-navy) 60%, var(--nf-navy-800)); color: #dbe5f3; padding: 3.5rem 0 3rem; }
.page-hero h1 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; }
.page-hero .lead { color: #c3d0e4; }
.page-hero .section-eyebrow { color: var(--nf-accent); }

.glossary-az { display: flex; flex-wrap: wrap; gap: .25rem; }
.glossary-az a { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 6px; background: var(--nf-bg); font-weight: 700; font-size: .85rem; text-decoration: none; color: var(--nf-navy-700); }
.glossary-az a:hover { background: var(--nf-accent); color: #111; }
.glossary-heading { font: 800 1.6rem var(--nf-font-head); color: var(--nf-accent-600); border-bottom: 2px solid var(--nf-border); padding-bottom: .25rem; margin: 1.5rem 0 .75rem; scroll-margin-top: 90px; }
.glossary-list { margin: 0; }
.glossary-item { padding: .8rem 0; border-bottom: 1px solid var(--nf-border); scroll-margin-top: 90px; }
.glossary-item dt { font-weight: 700; font-size: 1.05rem; color: var(--nf-text); }
.glossary-item dd { margin: .2rem 0 0; color: #334155; }
.glossary-item.is-target { background: #fff8eb; border-radius: 8px; padding-left: .75rem; padding-right: .75rem; }
.glossary-src { font-size: .8rem; margin-top: .3rem; color: var(--nf-muted); }

.pq-question { border: 0; padding: 0; margin: 0 0 1.5rem; }
.pq-js .pq-question { margin-bottom: 0; }
.pq-options { display: grid; gap: .6rem; }
.pq-option { display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; border: 1.5px solid var(--nf-border); border-radius: 12px; cursor: pointer; font-weight: 500; transition: border-color .15s, background .15s; }
.pq-option:hover { border-color: #c7d2e3; background: var(--nf-bg); }
.pq-option input { accent-color: var(--nf-accent-600); width: 1.1rem; height: 1.1rem; flex: none; }
.pq-option .bi { margin-left: auto; color: var(--nf-accent-600); opacity: 0; }
.pq-option:has(input:checked) { border-color: var(--nf-accent); background: #fff8eb; }
.pq-option:has(input:checked) .bi { opacity: 1; }
.pq-option:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(245,158,11,.35); }

.path-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.path-facts div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: .75rem 1rem; }
.path-facts strong { display: block; color: #fff; font: 800 1.4rem var(--nf-font-head); }
.path-facts span { font-size: .78rem; color: #b6c3d8; }
.path-steps { list-style: none; padding: 0; margin: 0; position: relative; }
.path-steps::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; background: var(--nf-border); }
.path-step { display: flex; gap: 1rem; align-items: center; margin-bottom: .75rem; position: relative; }
.path-num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--nf-navy-700); color: #fff; font-weight: 700; z-index: 1; }
.path-step:first-child .path-num { background: var(--nf-accent); color: #111; }

.feature-tile { height: 100%; border: 1px solid var(--nf-border); border-radius: 14px; background: var(--nf-surface); padding: 1.25rem; }
.feature-tile .ft-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #fff4e0; color: var(--nf-accent-600); font-size: 1.3rem; margin-bottom: .75rem; }
.mobile-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: var(--nf-surface); border-top: 1px solid var(--nf-border); box-shadow: 0 -6px 20px rgba(15,23,42,.08); padding: .6rem 16px; display: flex; align-items: center; gap: .75rem; }
@media (min-width: 992px) { .mobile-cta { display: none; } }
@media (max-width: 991.98px) { body.has-mobile-cta { padding-bottom: 72px; } }
.hero-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #e2e8f0; font-size: .8rem; font-weight: 600; }
.heatmap-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1.5rem; margin: 0; flex: 1; min-width: 220px; }
.heatmap-stats dt { font: 800 1.35rem var(--nf-font-head); color: var(--nf-text); }
.heatmap-stats dd { margin: 0; font-size: .78rem; color: var(--nf-muted); }
@media (max-width: 767.98px) { .lesson-content table { display: block; max-width: 100%; overflow-x: auto; } }

/* Super admin "log in as" bar: fixed, always visible, never covered by the sidebar or sticky bars. */
.impersonation-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2100; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  width: max-content; max-width: calc(100% - 32px); padding: .55rem .6rem .55rem 1rem; border-radius: 12px; background: #facc15; color: #111827;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: .9rem; line-height: 1.35; }
.impersonation-bar .bi-incognito { font-size: 1.15rem; }
@media print { .impersonation-bar { display: none; } }
body:has(.impersonation-bar) { padding-bottom: 96px; }
