/* ============================================================
   KVTOOLS app.css 2026 — Reset, base, layout, nav, components
   Imports design tokens from variables.css
   Google Fonts cargados via <link> en cada vista (no @import)
   ============================================================ */

/* JS-L03: Prevent FOUC with Alpine.js x-cloak */
[x-cloak] { display: none !important; }

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--kv-bg-soft);
  color: var(--kv-text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--kv-blue); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--kv-blue-light); }
img { max-width: 100%; display: block; }

/* === CONTAINER === */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* === SECTION HEADERS === */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--kv-blue);
  margin-bottom: var(--space-3);
}
.section-title {
  font-size: clamp(1.5rem, 3vw, var(--text-4xl));
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--kv-text);
  margin-bottom: var(--space-4);
}
.section-subtitle {
  font-size: var(--text-md);
  color: var(--kv-text-secondary);
  line-height: 1.7;
  max-width: var(--content-max);
}

/* ===== GLASSMORPHISM UTILITIES ===== */
.glass-panel {
    background: var(--bg-card, var(--kv-bg));
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-style: solid;
    border-width: 1px;
    border-color: var(--glass-border-light) var(--glass-border-dark) var(--glass-border-dark) var(--glass-border-light);
    box-shadow: var(--shadow-sm);
}
.glass-card {
    background: var(--bg-card, var(--kv-bg));
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-style: solid;
    border-width: 1px;
    border-color: var(--glass-border-light) var(--glass-border-dark) var(--glass-border-dark) var(--glass-border-light);
    box-shadow: var(--shadow-sm);
    transition: all 500ms cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover {
    background: var(--bg-card-hover, var(--kv-bg));
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.glass-input {
    background: var(--bg-input, var(--kv-bg));
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border-light);
}
.text-gradient {
    background: linear-gradient(135deg, var(--kv-blue) 0%, var(--kv-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.glass { background: rgba(255,255,255,0.70); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.80); }

/* Premium scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }

/* ===== SKELETON LOADERS ===== */
@keyframes skeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.8s ease-in-out infinite;
    border-radius: var(--radius);
}
.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-title { height: 22px; width: 45%; margin-bottom: 12px; border-radius: 6px; }
.skeleton-card {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.8s ease-in-out infinite;
    border-radius: var(--radius-lg); min-height: 180px; border: 1px solid var(--border);
}
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-badge { width: 60px; height: 20px; border-radius: 10px; }

/* ===== MICRO-INTERACTIONS ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes countUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.animate-in { animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
.animate-fade { animation: fadeIn 0.3s ease both; }
.animate-scale { animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* Staggered animation delays */
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.09s; }
.stagger > *:nth-child(4) { animation-delay: 0.12s; }
.stagger > *:nth-child(5) { animation-delay: 0.15s; }
.stagger > *:nth-child(6) { animation-delay: 0.18s; }
.stagger > *:nth-child(7) { animation-delay: 0.21s; }
.stagger > *:nth-child(8) { animation-delay: 0.24s; }
.stagger > *:nth-child(n+9) { animation-delay: 0.27s; }

/* ===== LAYOUT ===== */
.app-container { display: flex; min-height: 100vh; overflow: hidden; }
.app-sidebar {
    width: 260px; background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 1.5rem 1rem; display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; height: 100vh; z-index: 100;
    color: var(--text-on-dark);
}
.app-main { margin-left: 260px; flex: 1; padding: 2rem 2.5rem; min-height: 100vh; overflow-y: auto; max-height: 100vh; }

/* Sidebar */
.sidebar-logo {
    font-size: 1.2rem; font-weight: 800; color: #fff;
    padding: 0.5rem 0.75rem; margin-bottom: 2rem; letter-spacing: -0.5px;
}
.sidebar-logo span { color: var(--kv-orange); }
.sidebar-nav { list-style: none; flex: 1; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.85rem; border-radius: var(--radius);
    color: var(--text-on-dark-secondary); font-size: 0.88rem; font-weight: 500;
    transition: all var(--transition); border: 1px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active { background: rgba(0,85,184,0.30); color: #fff; border-color: rgba(0,85,184,0.40); font-weight: 600; }
.sidebar-nav .nav-icon { width: 20px; text-align: center; font-size: 1rem; }

.sidebar-user {
    border-top: 1px solid rgba(255,255,255,0.08); padding-top: 1rem; margin-top: auto;
}
.sidebar-user-info { font-size: 0.85rem; color: var(--text-on-dark-secondary); margin-bottom: 0.5rem; font-weight: 500; }
.sidebar-user-logout { font-size: 0.8rem; color: rgba(255,100,100,0.85); cursor: pointer; }
.sidebar-user-logout:hover { color: #ff6b6b; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.65rem 1.3rem; border: none; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 0.88rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition); outline: none; white-space: nowrap;
    text-decoration: none;
}
.btn-primary { background: var(--kv-blue); color: #fff; }
.btn-primary:hover { background: var(--kv-blue-light); box-shadow: 0 4px 20px var(--kv-blue-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-secondary {
  background: var(--kv-bg);
  color: var(--kv-blue);
  border: 1.5px solid var(--kv-blue);
}
.btn-secondary:hover {
  background: var(--kv-blue-50);
  box-shadow: 0 4px 12px var(--kv-blue-glow);
  transform: translateY(-2px);
}
.btn-cta { background: var(--kv-orange); color: #fff; }
.btn-cta:hover { background: var(--kv-orange-light); box-shadow: 0 4px 20px var(--kv-orange-glow); transform: translateY(-1px); }
.btn-cta:active { transform: translateY(0) scale(0.98); }
.btn-outline {
  background: transparent;
  color: var(--kv-text);
  border: 1.5px solid var(--kv-border);
}
.btn-outline:hover {
  border-color: var(--kv-blue);
  color: var(--kv-blue);
  background: var(--kv-blue-50);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost {
    background: var(--bg-card, var(--kv-bg)); color: var(--text-secondary); border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--kv-blue); color: var(--text-primary); background: var(--bg-card-hover, var(--kv-bg)); }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.7rem; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.8rem; font-size: 1rem; }
.btn-xl {
  padding: 1rem 2rem;
  font-size: var(--text-md);
  border-radius: var(--radius-md);
}
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* ===== INPUTS ===== */
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; margin-bottom: 0.4rem; font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.input-field {
    width: 100%; padding: 0.7rem 1rem; background: var(--bg-input, var(--kv-bg)); border: 1px solid var(--glass-border-light, var(--kv-border));
    border-radius: var(--radius); color: var(--text-primary); font-family: var(--font-body);
    font-size: 0.9rem; transition: all var(--transition);
}
.input-field:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--kv-blue-glow); }
.input-field::placeholder { color: var(--text-muted); }
select.input-field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238a8ea8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 2rem; }

/* Formularios nuevos (guia) */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--kv-text);
  margin-bottom: var(--space-2);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--kv-border);
  border-radius: var(--radius-md);
  background: var(--kv-bg);
  color: var(--kv-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--kv-blue);
  box-shadow: 0 0 0 3px rgba(0, 85, 184, 0.1);
}
.form-input::placeholder { color: var(--kv-text-muted); }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card, var(--kv-bg)); border-radius: var(--radius-lg);
    padding: 1.5rem; transition: all 500ms cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-style: solid; border-width: 1px;
    border-color: var(--glass-border-light, var(--kv-border)) var(--glass-border-dark, var(--kv-border)) var(--glass-border-dark, var(--kv-border)) var(--glass-border-light, var(--kv-border));
    box-shadow: var(--shadow-sm);
}
.card:hover { background: var(--bg-card-hover, var(--kv-bg)); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card:active { transform: translateY(0); }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem; line-height: 1.4; }
.card-meta { font-size: 0.8rem; color: var(--text-secondary); }
.card-interactive:hover {
  border-color: var(--kv-blue);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* === PROGRESS BAR (nuevo) === */
.progress-bar {
  height: 6px;
  background: var(--kv-bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--kv-blue);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.orange { background: var(--kv-orange); }
.progress-fill.success { background: var(--kv-success); }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; align-items: center; padding: 0.2rem 0.65rem; border-radius: 20px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-basico { background: rgba(34,197,94,0.10); color: var(--success); border: 1px solid rgba(34,197,94,0.15); }
.badge-intermedio { background: rgba(245,158,11,0.10); color: var(--warning); border: 1px solid rgba(245,158,11,0.15); }
.badge-avanzado { background: rgba(239,68,68,0.10); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }
.badge-active { background: rgba(0,85,184,0.08); color: var(--kv-blue); border: 1px solid rgba(0,85,184,0.15); }
.badge-sm { font-size: 0.65rem; padding: 0.15rem 0.5rem; }
.badge-blue    { background: var(--kv-blue-50);    color: var(--kv-blue);    border: 1px solid var(--kv-blue-100); }
.badge-orange  { background: var(--kv-orange-50);  color: var(--kv-orange);  border: 1px solid rgba(255,115,0,0.2); }
.badge-success { background: var(--kv-success-bg); color: var(--kv-success); }
.badge-warning { background: var(--kv-warning-bg); color: var(--kv-warning); }
.badge-danger  { background: var(--kv-danger-bg);  color: var(--kv-danger); }
.badge-new     { background: var(--kv-blue);        color: #fff; }
.badge-hot     { background: var(--kv-orange);      color: #fff; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1.5px solid var(--kv-border);
  color: var(--kv-text-secondary);
  background: var(--kv-bg);
  transition: var(--transition-fast);
}
.tag:hover { border-color: var(--kv-blue); color: var(--kv-blue); }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 2rem; }
.page-header h1 {
    font-size: 1.7rem; font-weight: 800; letter-spacing: -0.5px;
    color: var(--text-primary);
}
.page-header p { color: var(--text-secondary); margin-top: 0.3rem; font-size: 0.92rem; }

/* ===== NAVBAR PRINCIPAL (público, sticky, glassmorphism) ===== */
#main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  z-index: 100;
  transition: background var(--transition-base), box-shadow var(--transition-base);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
#main-nav.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 0 var(--kv-border), 0 4px 16px rgba(0, 85, 184, 0.06);
}

.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--kv-text);
  flex-shrink: 0;
}
.nav-logo .logo-kv   { color: var(--kv-blue); }
.nav-logo .logo-tool { color: var(--kv-text); }
.nav-logo .logo-s    { color: var(--kv-orange); }

.nav-search {
  flex: 1;
  max-width: 320px;
  position: relative;
}
.nav-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--kv-text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}
.nav-search-input {
  width: 100%;
  background: var(--kv-bg-muted);
  border: 1.5px solid var(--kv-border);
  border-radius: var(--radius-full);
  padding: 0.55rem 1rem 0.55rem 2.5rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--kv-text);
  outline: none;
  transition: var(--transition-fast);
}
.nav-search-input:focus {
  border-color: var(--kv-blue);
  background: var(--kv-bg);
  box-shadow: 0 0 0 3px rgba(0, 85, 184, 0.08);
}
.nav-search-input::placeholder { color: var(--kv-text-muted); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin-left: auto;
}
.nav-links a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--kv-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-fast);
}
.nav-links a:hover {
  color: var(--kv-blue);
  background: var(--kv-blue-50);
}
.nav-links a.active {
  color: var(--kv-blue);
  font-weight: 600;
}

.nav-cart {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--kv-border);
  background: var(--kv-bg);
  color: var(--kv-text);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  font-size: 1rem;
}
.nav-cart:hover { border-color: var(--kv-blue); color: var(--kv-blue); }
.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--kv-orange);
  color: #fff;
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.nav-mobile-btn {
  display: none;
  padding: var(--space-2);
  border: 1.5px solid var(--kv-border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--kv-text);
  font-size: 1.1rem;
}
@media (max-width: 768px) {
  .nav-mobile-btn { display: flex; }
  .nav-links, .nav-search { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: fixed; top: var(--nav-height); left: 0; right: 0; background: var(--kv-bg); border-bottom: 1px solid var(--kv-border); padding: var(--space-4); gap: var(--space-2); }
}

/* === STATS STRIP (azul) === */
.stats-strip {
  background: var(--kv-blue);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.stats-strip-item {
  padding: var(--space-5) var(--space-6);
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.stats-strip-item:last-child { border-right: none; }
.stats-strip-number {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.025em;
  line-height: 1;
}
.stats-strip-label {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
  margin-top: var(--space-1);
}

/* === FOOTER === */
.kv-footer {
  background: var(--kv-text);
  color: rgba(255,255,255,0.7);
  padding: var(--space-12) 0 var(--space-8);
}
.footer-logo { color: #fff; font-size: 1.2rem; font-weight: 800; margin-bottom: var(--space-3); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-10);
  margin-bottom: var(--space-10);
}
.footer-col h4 { color: #fff; font-size: var(--text-sm); font-weight: 700; margin-bottom: var(--space-4); }
.footer-col a { display: block; color: rgba(255,255,255,0.6); font-size: var(--text-sm); text-decoration: none; margin-bottom: var(--space-2); transition: color var(--transition-fast); }
.footer-col a:hover { color: var(--kv-orange); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
}

/* ===== COURSE GRID (Dashboard) ===== */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; }
.course-card { position: relative; display: flex; flex-direction: column; }
.course-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.course-card .progress-bar {
    height: 4px; background: var(--border); border-radius: 2px; margin-top: auto; overflow: hidden;
}
.course-card .progress-fill { height: 100%; background: linear-gradient(90deg, var(--kv-blue), var(--kv-orange)); border-radius: 2px; transition: width 0.6s ease; }
.course-card .progress-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; text-align: right; }
.course-card.expired { opacity: 0.45; }
.course-card.expired::after {
    content: 'Acceso vencido'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%); background: var(--danger); color: #fff;
    padding: 0.5rem 1.2rem; border-radius: var(--radius); font-size: 0.85rem; font-weight: 700;
}
.course-card-stats { display: flex; gap: 1rem; margin-top: 0.75rem; font-size: 0.78rem; color: var(--text-muted); }
.course-card-stats span { display: flex; align-items: center; gap: 0.3rem; }

/* ===== COURSE DETAIL PAGE ===== */
.course-detail { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: start; }
.course-detail-main { min-width: 0; }
.course-detail-sidebar { position: sticky; top: 2rem; }

.course-info-card {
    background: var(--bg-card, var(--kv-bg)); border-radius: var(--radius-lg);
    padding: 1.5rem; margin-bottom: 1.5rem;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-style: solid; border-width: 1px;
    border-color: var(--glass-border-light) var(--glass-border-dark) var(--glass-border-dark) var(--glass-border-light);
    box-shadow: var(--shadow-sm);
}
.course-stat-row { display: flex; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.course-stat-row:last-child { border-bottom: none; }
.course-stat-label { color: var(--text-muted); }
.course-stat-value { color: var(--text-primary); font-weight: 600; }
.course-about { margin-bottom: 2rem; }
.course-about h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.course-about p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.7; }

/* ===== MODULE LIST ===== */
.module-list { display: flex; flex-direction: column; gap: 0.5rem; }
.module-list-header { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.module-item {
    display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem;
    background: var(--bg-card, var(--kv-bg)); border-radius: var(--radius);
    cursor: pointer; transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}
.module-item:hover { border-color: var(--kv-blue); background: var(--bg-card-hover, var(--kv-bg)); transform: translateX(4px); }
.module-num {
    width: 38px; height: 38px; border-radius: 50%; background: rgba(0,85,184,0.08);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: var(--kv-blue); flex-shrink: 0; border: 1px solid rgba(0,85,184,0.15);
}
.module-item.completed .module-num { background: rgba(34,197,94,0.12); color: var(--success); border-color: rgba(34,197,94,0.2); }
.module-info { flex: 1; min-width: 0; }
.module-info h3 { font-size: 0.92rem; font-weight: 600; }
.module-info p { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.1rem; }
.module-duration { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.module-badges { display: flex; gap: 0.35rem; flex-shrink: 0; }
.module-progress-ring { width: 36px; height: 36px; flex-shrink: 0; }

/* ===== MODULE VIEW (Video + Chat split) ===== */
.module-view { display: grid; grid-template-columns: 1.5fr 1fr; gap: 0; height: calc(100vh - 4rem); }
.lesson-sidebar { background: var(--glass-bg); border-right: 1px solid var(--glass-border-light); overflow-y: auto; max-height: calc(100vh - 4rem); }
.lesson-sidebar-header { padding: 0.75rem 1rem; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--glass-border-light); }
.lesson-sidebar-list { padding: 0.25rem 0; }
.lesson-sidebar-item { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.6rem 1rem; cursor: pointer; transition: background 0.15s; font-size: 0.85rem; }
.lesson-sidebar-item:hover { background: var(--glass-hover); }
.lesson-sidebar-item.active { background: var(--accent-soft); }
.lesson-sidebar-item.completed .lesson-num { color: var(--success); font-weight: 700; }
.lesson-num { min-width: 1.2rem; text-align: center; color: var(--text-muted); font-size: 0.78rem; font-weight: 600; padding-top: 2px; }
.lesson-meta { flex: 1; min-width: 0; }
.lesson-title { display: block; line-height: 1.3; }
.module-view:has(.lesson-sidebar) { grid-template-columns: 220px 1.3fr 1fr; }
.video-panel { background: rgba(0,0,0,0.60); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); display: flex; flex-direction: column; border-radius: var(--radius-lg) 0 0 var(--radius-lg); overflow: hidden; border: 1px solid var(--glass-border-light); border-right: none; }
.video-panel video, .video-panel iframe { width: 100%; flex: 1; border: none; }
.video-title-bar {
    padding: 0.75rem 1rem; background: var(--bg-secondary, var(--kv-bg)); font-size: 0.9rem; font-weight: 600;
    display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border);
}
.video-wrapper { flex: 1; display: flex; flex-direction: column; }
.video-wrapper video { flex: 1; width: 100%; background: #000; }
.player-controls {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.4rem 0.75rem; background: var(--bg-secondary, var(--kv-bg)); border-top: 1px solid var(--border);
}
.speed-control { display: flex; align-items: center; gap: 0.4rem; }
.speed-btn {
    width: 26px; height: 26px; border: 1px solid var(--border); background: transparent;
    color: var(--text-secondary); border-radius: 4px; cursor: pointer; font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.speed-btn:hover { border-color: var(--kv-blue); color: var(--kv-blue); }
.speed-display { font-family: var(--font-mono); font-size: 0.8rem; color: var(--kv-blue); font-weight: 600; min-width: 30px; text-align: center; }
.player-shortcuts-hint { font-size: 0.7rem; color: var(--text-muted); display: flex; gap: 0.75rem; }
.video-error { padding: 2rem; color: var(--danger); text-align: center; }

/* ===== CHAT PANEL ===== */
.chat-panel {
    display: flex; flex-direction: column;
    background: var(--bg-surface, var(--kv-bg));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid var(--border);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    overflow: hidden;
}
.chat-header {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary, var(--kv-bg));
    display: flex; align-items: center; gap: 0.75rem;
}
.chat-scope-toggle {
    display: flex; background: var(--bg-input, var(--kv-bg-muted)); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--glass-border-light);
}
.chat-scope-toggle button {
    padding: 0.4rem 0.8rem; border: none; background: transparent;
    color: var(--text-secondary); font-size: 0.78rem; cursor: pointer; font-family: var(--font-body);
    transition: all var(--transition); font-weight: 500;
}
.chat-scope-toggle button.active { background: var(--kv-blue); color: #fff; box-shadow: 0 2px 12px var(--kv-blue-glow); }

.chat-messages {
    flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.msg { max-width: 92%; border-radius: var(--radius-lg); font-size: 0.88rem; line-height: 1.65; }
.msg-user { align-self: flex-end; }
.msg-user .msg-content {
    background: linear-gradient(135deg, var(--kv-blue), var(--kv-blue-light));
    color: #fff; padding: 0.8rem 1rem; border-radius: var(--radius-lg); border-bottom-right-radius: 4px;
    box-shadow: 0 4px 16px var(--kv-blue-glow);
}
.msg-assistant { align-self: flex-start; }
.msg-assistant .msg-content {
    background: var(--bg-card, var(--kv-bg));
    border: 1px solid var(--border);
    padding: 0.85rem 1.1rem; border-radius: var(--radius-lg); border-bottom-left-radius: 4px;
}
.msg-assistant .msg-content strong { color: var(--kv-blue); }
.msg-system .msg-content {
    background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.2);
    text-align: center; font-size: 0.85rem; color: var(--text-secondary);
}

.msg-text { word-wrap: break-word; overflow-wrap: break-word; }

.msg-extended-badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.20);
    color: var(--warning); font-size: 0.72rem; font-weight: 600;
    padding: 0.25rem 0.65rem; border-radius: 20px; margin-bottom: 0.6rem;
}
.extended-icon { display: inline-flex; vertical-align: middle; }
.extended-icon svg { width: 12px; height: 12px; }

.msg-code-block {
    background: #f1f5f9; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.75rem 1rem; margin: 0.5rem 0; overflow-x: auto;
    font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.5; color: var(--text-primary);
}
.msg-inline-code {
    background: #f1f5f9; border: 1px solid var(--border); border-radius: 4px;
    padding: 0.1rem 0.35rem; font-family: var(--font-mono); font-size: 0.82rem; color: var(--kv-blue);
}

.msg-list { list-style: none; padding: 0; margin: 0.4rem 0; }
.msg-list-item { padding: 0.2rem 0 0.2rem 0.5rem; position: relative; }
.msg-list-item.numbered .list-num { color: var(--kv-blue); font-weight: 700; margin-right: 0.3rem; }
.msg-list-item.bullet::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--kv-blue); position: absolute; left: -0.5rem; top: 0.65rem; }
.msg-list-item.bullet { padding-left: 0.75rem; }

.msg-divider { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }

/* Citations */
.citations-container { margin-top: 0.5rem; }
.citations-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.25rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.citation-card {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--bg-card, var(--kv-bg)); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.45rem 0.7rem; margin-top: 0.35rem; font-size: 0.78rem; cursor: pointer;
    transition: all var(--transition);
}
.citation-card:hover { border-color: var(--kv-blue); background: var(--bg-card-hover, var(--kv-bg)); }
.citation-badge {
    width: 20px; height: 20px; border-radius: 50%; background: var(--kv-blue); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 0.62rem; font-weight: 700; flex-shrink: 0;
}
.citation-module { color: var(--kv-blue); font-weight: 600; white-space: nowrap; }
.citation-time { color: var(--warning); font-family: var(--font-mono); font-size: 0.72rem; }
.citation-quote { color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citation-play { color: var(--kv-blue); font-weight: 600; white-space: nowrap; font-size: 0.75rem; display: inline-flex; align-items: center; gap: 0.25rem; }
.citation-play svg { width: 10px; height: 10px; }
.citation-highlight, .citation-active { border-color: var(--kv-blue) !important; background: var(--accent-soft) !important; }
.cite-ref { color: var(--kv-blue); cursor: pointer; font-weight: 700; transition: all var(--transition); }
.cite-ref:hover, .cite-highlight { background: var(--kv-blue-glow); border-radius: 3px; padding: 0 2px; }

/* Feedback */
.feedback-btns { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.fb-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; background: var(--bg-card, var(--kv-bg)); border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer; color: var(--text-muted); transition: all var(--transition);
}
.fb-btn:hover { border-color: var(--kv-blue); color: var(--text-primary); background: var(--bg-card-hover, var(--kv-bg)); }
.fb-btn.selected { background: var(--kv-blue); color: #fff; border-color: var(--kv-blue); box-shadow: 0 2px 12px var(--kv-blue-glow); }
.msg-meta { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.35rem; text-align: right; }

/* Chat welcome */
.chat-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.5rem; flex: 1; }
.chat-welcome-icon { margin-bottom: 0.75rem; opacity: 0.8; color: var(--kv-blue); }
.chat-welcome-icon svg { width: 40px; height: 40px; }
.chat-welcome h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.chat-welcome p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; max-width: 280px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; justify-content: center; }
.suggestion-chip {
    padding: 0.35rem 0.75rem; background: var(--bg-card, var(--kv-bg)); border: 1px solid var(--border);
    border-radius: 20px; color: var(--text-secondary); font-size: 0.78rem; cursor: pointer;
    font-family: var(--font-body); transition: all var(--transition);
}
.suggestion-chip:hover { border-color: var(--kv-blue); color: var(--kv-blue); background: var(--accent-soft); }

/* Error / Retry */
.msg-error {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1rem;
    background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius); font-size: 0.83rem; color: var(--danger); align-self: stretch;
}
.error-icon { display: inline-flex; vertical-align: middle; color: var(--danger); }
.error-icon svg { width: 16px; height: 16px; }
.btn-retry {
    margin-left: auto; padding: 0.3rem 0.7rem; background: var(--danger); color: #fff;
    border: none; border-radius: var(--radius); font-size: 0.78rem; cursor: pointer;
    font-family: var(--font-body); font-weight: 600; white-space: nowrap;
}

/* Typing */
.typing-indicator {
    padding: 0.6rem 1rem; display: flex; gap: 5px; align-items: center; align-self: flex-start;
    background: var(--bg-card, var(--kv-bg)); border: 1px solid var(--border);
    border-radius: var(--radius-lg); border-bottom-left-radius: 4px;
}
.typing-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--kv-blue);
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; } 40% { transform: scale(1); opacity: 1; } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat input */
.chat-input-area {
    padding: 0.75rem 1rem; border-top: 1px solid var(--border);
    background: var(--bg-secondary, var(--kv-bg));
    display: flex; gap: 0.5rem; align-items: flex-end;
}
.chat-input-area textarea {
    flex: 1; padding: 0.6rem 0.85rem; background: var(--bg-input, var(--kv-bg)); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-family: var(--font-body); font-size: 0.88rem;
    resize: none; min-height: 38px; max-height: 120px; line-height: 1.5; overflow-y: auto;
}
.chat-input-area textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--kv-blue-glow); }

/* ===== LOGIN ===== */
.login-wrapper {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: var(--kv-dark);
    background-image:
        radial-gradient(ellipse at 20% 40%, rgba(0,85,184,0.20) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 25%, rgba(10,25,47,0.50) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 85%, rgba(255,115,0,0.08) 0%, transparent 50%);
}
.login-box {
    width: 100%; max-width: 420px; padding: 2.5rem;
    background: rgba(255,255,255,0.08);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-xl); box-shadow: 0 16px 64px rgba(0,0,0,0.30);
    position: relative; overflow: hidden;
}
.login-box::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 30%, rgba(0,85,184,0.06), transparent 50%);
    pointer-events: none;
}
.login-box h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.3rem; letter-spacing: -0.5px; position: relative; color: #fff; }
.login-box p { color: rgba(255,255,255,0.60); font-size: 0.9rem; margin-bottom: 2rem; position: relative; }
.login-box .input-group label { color: rgba(255,255,255,0.65); }
.login-box .input-field { background: rgba(0,0,0,0.30); border-color: rgba(255,255,255,0.12); color: #fff; }
.login-box .input-field::placeholder { color: rgba(255,255,255,0.30); }
.login-box .input-field:focus { border-color: var(--kv-blue); box-shadow: 0 0 0 3px rgba(0,85,184,0.25); }
.login-error {
    background: rgba(239,68,68,0.10); border: 1px solid rgba(239,68,68,0.25);
    color: #ff8888; padding: 0.65rem 1rem; border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 1rem; display: none; position: relative;
}

/* ===== QUIZ ===== */
.quiz-container { max-width: 700px; }
.quiz-header { margin-bottom: 1.5rem; }
.quiz-header h2 { font-size: 1.1rem; font-weight: 700; }
.quiz-progress { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.quiz-progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: var(--kv-blue); border-radius: 3px; transition: width 0.3s; }
.quiz-progress-text { font-size: 0.8rem; color: var(--text-muted); }
.quiz-question { margin-bottom: 1.5rem; }
.quiz-question h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.85rem; line-height: 1.5; }
.quiz-option {
    display: block; padding: 0.75rem 1rem; margin-bottom: 0.4rem; width: 100%;
    background: var(--bg-card, var(--kv-bg)); border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; font-size: 0.9rem; transition: all var(--transition); text-align: left;
    font-family: var(--font-body); color: var(--text-primary);
}
.quiz-option:hover:not(.correct):not(.wrong) { border-color: var(--kv-blue); background: var(--accent-soft); transform: translateX(4px); }
.quiz-option.correct { border-color: var(--success); background: rgba(34,197,94,0.08); color: var(--success); box-shadow: 0 0 20px rgba(34,197,94,0.1); }
.quiz-option.wrong { border-color: var(--danger); background: rgba(239,68,68,0.06); color: var(--danger); }
.quiz-option.selected { border-width: 2px; }
.quiz-explanation {
    margin-top: 0.5rem; font-size: 0.83rem; color: var(--text-secondary);
    padding: 0.75rem; background: var(--bg-card, var(--kv-bg)); border-radius: var(--radius); border-left: 3px solid var(--kv-blue);
}
.quiz-result { text-align: center; padding: 2rem; }
.quiz-result .score { font-size: 3rem; font-weight: 800; }
.quiz-result .score.pass { color: var(--success); }
.quiz-result .score.fail { color: var(--danger); }

/* ===== FAQ ===== */
.faq-list { display: flex; flex-direction: column; gap: 0.5rem; }
.faq-item {
    background: var(--bg-card, var(--kv-bg)); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; transition: all var(--transition);
}
.faq-item:hover { border-color: var(--kv-blue); background: var(--bg-card-hover, var(--kv-bg)); }
.faq-question {
    padding: 0.85rem 1rem; cursor: pointer; font-size: 0.9rem; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
.faq-question .faq-toggle { color: var(--text-muted); transition: transform var(--transition); font-size: 0.8rem; }
.faq-item.open .faq-toggle { transform: rotate(180deg); }
.faq-answer { padding: 0 1rem 1rem; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.7; display: none; }
.faq-item.open .faq-answer { display: block; }
.faq-count { font-size: 0.72rem; color: var(--text-muted); }

/* ===== NOTIFICATIONS ===== */
.notif-bell { position: relative; cursor: pointer; }
.notif-badge {
    position: absolute; top: -4px; right: -4px; width: 16px; height: 16px;
    background: var(--kv-orange); border-radius: 50%;
    font-size: 0.6rem; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
    box-shadow: 0 2px 8px rgba(255,92,92,0.4);
}
.notif-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-height: 400px; overflow-y: auto;
    background: rgba(255,255,255,0.95);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); z-index: 200; display: none;
}
.notif-dropdown.open { display: block; animation: fadeInUp 0.2s ease both; }
.notif-item { padding: 0.75rem 1rem; border-bottom: 1px solid var(--glass-border-dark); font-size: 0.83rem; cursor: pointer; transition: all var(--transition); }
.notif-item:hover { background: rgba(0,85,184,0.04); }
.notif-item.unread { border-left: 3px solid var(--kv-blue); background: var(--accent-soft); }
.notif-item .notif-title { font-weight: 600; margin-bottom: 0.2rem; }
.notif-item .notif-body { color: var(--text-secondary); font-size: 0.78rem; }
.notif-item .notif-time { color: var(--text-muted); font-size: 0.72rem; margin-top: 0.2rem; }
.notif-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* ===== STAT GRID ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    padding: 1.25rem; background: var(--bg-card, var(--kv-bg));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--kv-orange), transparent);
    opacity: 0; transition: opacity 0.3s;
}
.stat-card:hover { transform: translateY(-2px); background: var(--bg-card-hover, var(--kv-bg)); box-shadow: var(--shadow-lg); }
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--kv-blue); letter-spacing: -1px; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.2rem; font-weight: 500; }

/* ===== ADMIN ===== */
.admin-section { margin-bottom: 2.5rem; }
.admin-section h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.admin-table th { text-align: left; padding: 0.65rem 0.75rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.5px; border-bottom: 2px solid var(--glass-border-light); }
.admin-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--glass-border-dark); }
.admin-table tr:hover td { background: rgba(0,85,184,0.03); }
.admin-form {
    max-width: 550px; margin-top: 1rem; padding: 1.25rem;
    background: var(--bg-card, var(--kv-bg));
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.admin-form-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 1rem; }

.admin-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--glass-border-light); margin-bottom: 2rem; }
.admin-tab {
    padding: 0.75rem 1.5rem; border: none; background: transparent;
    color: var(--text-secondary); font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition);
    position: relative;
}
.admin-tab:hover { color: var(--text-primary); background: rgba(0,85,184,0.03); }
.admin-tab.active { color: var(--kv-blue); border-bottom-color: var(--kv-blue); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ===== ALERT BANNER ===== */
.alert-banner {
    padding: 0.75rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem;
    font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem;
}
.alert-warning { background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.18); color: var(--warning); }
.alert-info { background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.18); color: var(--kv-info); }
.alert-success { background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.18); color: var(--success); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--glass-border-light); margin-bottom: 1.5rem; }
.tabs button {
    padding: 0.7rem 1.25rem; border: none; background: transparent;
    color: var(--text-secondary); font-family: var(--font-body); font-size: 0.88rem; font-weight: 600;
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition);
}
.tabs button:hover { color: var(--text-primary); background: rgba(0,85,184,0.03); }
.tabs button.active { color: var(--kv-blue); border-bottom-color: var(--kv-blue); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== SEARCH ===== */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.search-bar input { flex: 1; }
.search-results { display: flex; flex-direction: column; gap: 0.75rem; }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.83rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-blue { color: var(--kv-blue); }
.text-orange { color: var(--kv-orange); }
.font-mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ===== HAMBURGER MENU (mobile) ===== */
.mobile-menu-btn {
    display: none; position: fixed; top: 0.75rem; left: 0.75rem; z-index: 1001;
    width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--glass-border-light);
    background: rgba(255,255,255,0.05); color: var(--text-primary); font-size: 1.2rem;
    cursor: pointer; align-items: center; justify-content: center;
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.mobile-menu-btn:active { transform: scale(0.92); }
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.60);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 999;
}
.sidebar-overlay.open { display: block; }

/* ===== FLOATING AI CHAT FAB ===== */
.ai-chat-fab {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 900;
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--kv-blue), var(--kv-orange));
    color: #fff; font-size: 1.4rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 24px rgba(0,85,184,0.35), 0 2px 8px rgba(255,115,0,0.25);
    transition: all var(--transition-spring);
}
.ai-chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 32px rgba(0,85,184,0.45), 0 4px 16px rgba(255,115,0,0.35); }
.ai-chat-fab:active { transform: scale(0.95); }
.ai-chat-fab .fab-icon { transition: transform 0.3s ease; }
.ai-chat-fab.open .fab-icon { transform: rotate(45deg); }
.ai-chat-fab .fab-pulse {
    position: absolute; inset: -4px; border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,85,184,0.3), rgba(255,115,0,0.3));
    animation: fabPulse 2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes fabPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0; }
}

/* Floating chat window */
.ai-chat-window {
    position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 899;
    width: 400px; height: 650px; max-height: calc(100vh - 7rem);
    background: rgba(255,255,255,0.95);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 0 16px 64px rgba(0,85,184,0.15), 0 0 0 1px rgba(0,85,184,0.05);
    display: none; flex-direction: column; overflow: hidden;
    animation: chatWindowIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ai-chat-window.open { display: flex; }
@keyframes chatWindowIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.ai-chat-window .chat-window-header {
    padding: 1rem 1.25rem; display: flex; align-items: center; gap: 0.75rem;
    border-bottom: 1px solid var(--glass-border-light);
}
.ai-chat-window .chat-window-header .chat-ai-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--kv-blue), var(--kv-orange));
    display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #fff; flex-shrink: 0;
}
.ai-chat-window .chat-window-header h4 { font-size: 0.92rem; font-weight: 700; }
.ai-chat-window .chat-window-header p { font-size: 0.75rem; color: var(--text-muted); }
.ai-chat-window .chat-window-body {
    flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
}
.ai-chat-window .chat-window-input {
    padding: 0.75rem 1rem; border-top: 1px solid var(--glass-border-light);
    display: flex; gap: 0.5rem; align-items: flex-end;
}
.ai-chat-window .chat-window-input textarea {
    flex: 1; padding: 0.6rem 0.85rem; background: var(--bg-input, var(--kv-bg)); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-family: var(--font-body); font-size: 0.85rem;
    resize: none; min-height: 38px; max-height: 100px; line-height: 1.5;
}
.ai-chat-window .chat-window-input textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--kv-blue-glow); }
.ai-chat-window .chat-window-input .btn-send {
    width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--kv-blue), var(--kv-orange)); color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: all var(--transition);
}
.ai-chat-window .chat-window-input .btn-send:hover { transform: scale(1.05); box-shadow: 0 2px 12px var(--kv-blue-glow); }

.ai-chat-window .chat-bubble {
    max-width: 85%; padding: 0.75rem 1rem; border-radius: var(--radius-lg); font-size: 0.85rem; line-height: 1.6;
}
.ai-chat-window .chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--kv-blue), var(--kv-blue-light));
    color: #fff; border-bottom-right-radius: 4px;
    box-shadow: 0 4px 16px var(--kv-blue-glow);
}
.ai-chat-window .chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-card, var(--kv-bg)); border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1200px) {
    .course-detail { grid-template-columns: 1fr; }
    .course-detail-sidebar { position: static; }
}

@media (max-width: 1024px) {
    .app-sidebar { width: 64px; padding: 1rem 0.5rem; }
    .app-sidebar .sidebar-logo span,
    .app-sidebar .sidebar-nav a span,
    .app-sidebar .sidebar-nav-item span,
    .app-sidebar .sidebar-nav-external span,
    .app-sidebar .sidebar-group-title span,
    .app-sidebar .sidebar-group-title::after,
    .app-sidebar .sidebar-user-info,
    .app-sidebar .sidebar-user-logout { display: none; }
    .app-sidebar .sidebar-nav-item { padding: 0.5rem; justify-content: center; }
    .app-sidebar .sidebar-nav-external { padding: 0.5rem; justify-content: center; }
    .app-sidebar .sidebar-group-title { padding: 0.3rem 0.5rem; justify-content: center; }
    .app-main { margin-left: 64px; padding: 1.5rem; }
    .module-view { grid-template-columns: 1fr; grid-template-rows: 50vh 1fr; height: auto; }
    .module-view:has(.lesson-sidebar) { grid-template-columns: 1fr; grid-template-rows: auto 50vh 1fr; }
    .lesson-sidebar { max-height: 200px; border-right: none; border-bottom: 1px solid var(--glass-border-light); }
    .course-grid { gap: 1rem; }
}

@media (max-width: 768px) {
    html { font-size: 14px; }
    .app-sidebar {
        display: flex; position: fixed; left: -280px; top: 0; bottom: 0;
        width: 260px; z-index: 1000; transition: left 0.3s ease;
        padding: 1.25rem; flex-direction: column;
    }
    .app-sidebar.open { left: 0; }
    .app-sidebar .sidebar-logo span,
    .app-sidebar .sidebar-nav a span,
    .app-sidebar .sidebar-nav-item span,
    .app-sidebar .sidebar-nav-external span,
    .app-sidebar .sidebar-group-title span,
    .app-sidebar .sidebar-group-title::after,
    .app-sidebar .sidebar-user-info,
    .app-sidebar .sidebar-user-logout { display: block; }
    .app-sidebar .sidebar-nav-item { padding: 0.5rem 0.85rem 0.5rem 1.5rem; justify-content: flex-start; }
    .app-sidebar .sidebar-nav-external { padding: 0.6rem 0.85rem; justify-content: flex-start; }
    .app-sidebar .sidebar-group-title { padding: 0.5rem 0.85rem; justify-content: flex-start; }
    .app-sidebar .sidebar-group-title::after { display: inline-block; }
    .mobile-menu-btn { display: flex; }
    .app-main { margin-left: 0; padding: 1rem; padding-top: 3.5rem; }
    .course-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .course-grid-item { min-width: 0; }
    .module-view { grid-template-rows: 45vh 1fr; height: auto; min-height: calc(100vh - 3rem); }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .citation-card { flex-wrap: wrap; }
    .citation-quote { min-width: 100%; margin-top: 0.25rem; }
    .page-header h1 { font-size: 1.3rem; }
    .page-header p { font-size: 0.85rem; }
    .chat-panel { min-height: 50vh; }
    .notif-dropdown { width: calc(100vw - 2rem); max-width: 320px; right: -1rem; }
    .video-title-bar { font-size: 0.82rem; overflow: hidden; }
    .video-title-bar h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
    .chat-scope-toggle { flex-wrap: wrap; gap: 0.35rem; }
    .stats-strip { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
}

@media (max-width: 480px) {
    html { font-size: 13px; }
    .app-main { padding: 0.75rem; padding-top: 3.25rem; }
    .module-view { grid-template-rows: 38vh 1fr; }
    .page-header h1 { font-size: 1.15rem; }
    .course-card { padding: 1rem; }
    .stat-grid { grid-template-columns: 1fr; }
    .quiz-option { padding: 0.6rem 0.8rem; font-size: 0.82rem; }
    .quiz-result .score { font-size: 2.5rem; }
    .cert-frame { padding: 1.5rem 1rem; }
    .btn { padding: 0.55rem 1rem; font-size: 0.82rem; }
    .btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }
    .chat-input-group textarea { font-size: 0.85rem; }
    .video-controls { flex-wrap: wrap; gap: 0.35rem; }
    .ai-chat-fab { width: 48px; height: 48px; font-size: 1.2rem; bottom: 1rem; right: 1rem; }
    .ai-chat-window { width: calc(100vw - 1.5rem); right: 0.75rem; bottom: 4.5rem; height: calc(100vh - 6rem); border-radius: var(--radius-lg); }
    .stats-strip { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PHASE 5 — Global Reset & Premium Baseline
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--kv-text);
  background: var(--kv-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

:focus-visible {
  outline: 2px solid var(--kv-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.75rem 1.5rem;
  background: var(--kv-blue);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 1rem;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--kv-text-muted); }

::selection {
  background: var(--kv-blue);
  color: #fff;
}

img, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--kv-border);
  border-top-color: var(--kv-blue);
  border-radius: 50%;
  animation: kv-spin 0.6s linear infinite;
}
@keyframes kv-spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
  background-size: 200% 100%;
  animation: kv-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes kv-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--kv-text-muted);
}
.empty-state svg { opacity: 0.3; margin-bottom: 1rem; }
.empty-state p { max-width: 320px; line-height: 1.6; }

/* ============================================================
   PHASE 14 — Global Mobile Responsive Fixes
   ============================================================ */

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    .app-sidebar.open {
        left: 0;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
    }
    .app-main {
        margin-left: 0;
        padding: 1rem;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
    .mobile-menu-btn {
        display: flex;
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        z-index: 998;
        width: 40px;
        height: 40px;
        background: var(--kv-bg);
        border: 1px solid var(--kv-border);
        border-radius: var(--radius-md);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        color: var(--kv-text);
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn { display: none; }
    .sidebar-overlay { display: none; }
}

@media (max-width: 768px) {
    .data-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .page-header h1 {
        font-size: 1.25rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn, button, a {
        min-height: 44px;
    }
}

/* ============================================================
   PHASE 12 — Course Module Navigation
   ============================================================ */

.course-module-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: var(--kv-text);
    transition: all 0.2s ease;
    background: var(--kv-bg);
}
.course-module-item:hover {
    border-color: var(--kv-blue-100);
    background: var(--kv-blue-50);
    transform: translateX(4px);
}
.course-module-item.completed {
    border-color: rgba(22, 163, 74, 0.2);
    background: var(--kv-success-bg);
}
.course-module-item.active {
    border-color: var(--kv-blue);
    background: var(--kv-blue-50);
    box-shadow: 0 0 0 3px var(--kv-blue-glow);
}

.module-progress-ring {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.module-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.module-item-num {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--kv-text-muted);
    background: var(--kv-bg-muted);
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.course-module-item.completed .module-item-num {
    background: var(--kv-success);
    color: #fff;
}
.module-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.module-item-duration {
    font-size: 0.72rem;
    color: var(--kv-text-muted);
    flex-shrink: 0;
}

/* ============================================================
   AUDIT FIXES — Accessibility, Responsive, Contrast, Focus
   ============================================================ */

/* CSS-M03: Global focus-visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--kv-blue);
    outline-offset: 2px;
}
:focus:not(:focus-visible) {
    outline: none;
}

/* CSS-H06: Touch targets minimum 44px */
.btn, button, [role="button"], .btn-icon,
input[type="submit"], input[type="button"],
a.btn, select {
    min-height: 44px;
}
.btn-xs {
    min-height: 36px;
    padding: 0.5rem 0.75rem;
}
.btn-icon {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* CSS-H04: Contrast fix — ensure muted text meets WCAG AA 4.5:1 */
.text-muted, [class*="text-muted"] {
    color: #64748B; /* 4.74:1 contrast on white — passes AA */
}

/* CSS-H05: Mobile responsive < 480px */
@media (max-width: 480px) {
    body { font-size: 14px; }
    .container { padding: 0 var(--space-3); }
    .page-header h1 { font-size: 1.1rem; }
    .page-header p { font-size: 0.8rem; }
    .card { padding: var(--space-3); }
    .btn { font-size: 0.85rem; padding: 0.6rem 1rem; width: 100%; }
    .flex-between { flex-direction: column; gap: 0.5rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.4rem; font-size: 0.75rem; }
    .modal-content { width: 95vw; max-width: 95vw; margin: 1rem; padding: 1rem; }
    .app-main { padding: 0.75rem; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .kpi-card { padding: 0.75rem; }
    .kpi-value { font-size: 1.2rem; }
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tab-btn { white-space: nowrap; flex-shrink: 0; font-size: 0.8rem; }
    .sidebar-user { font-size: 0.8rem; }
}

/* CSS-M04: Backdrop filter fallback for Firefox */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .glass-bg, [class*="glass"] {
        background: rgba(255, 255, 255, 0.96);
    }
}

/* TPL-C04: Modal classes (replaces inline styles) */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-backdrop, 900);
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-card {
    background: var(--bg-card, #fff);
    border-radius: 14px;
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}
.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dashboard sidebar user section */
.sidebar-user-name-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.sidebar-user-actions {
    display: flex;
    gap: 0.5rem;
    font-size: 0.78rem;
}
.sidebar-profile-link {
    color: var(--text-muted);
    text-decoration: none;
}

/* Contact form grid */
.contact-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* JS-M06: Player chapter marker and tooltip styles (moved from inline cssText) */
.plyr-chapter-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--kv-orange, #FF7300);
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 5;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.plyr-chapter-marker:hover {
    transform: translate(-50%, -50%) scale(1.4);
}
.plyr-chapter-marker:hover .plyr-chapter-tooltip {
    opacity: 1;
}
.plyr-chapter-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--kv-text, #0A192F);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* TPL-M02: Breadcrumb component */
.breadcrumb {
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}
.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    padding: 0;
    margin: 0;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: var(--kv-text-muted);
    margin-right: var(--space-1);
}
.breadcrumb-item a {
    color: var(--kv-text-muted);
    text-decoration: none;
}
.breadcrumb-item a:hover {
    color: var(--kv-blue);
}
.breadcrumb-item[aria-current="page"] {
    color: var(--kv-text);
    font-weight: 500;
}

/* CSS-M05: Mobile menu accessibility — toggle aria-hidden */
.app-sidebar[aria-hidden="true"] {
    visibility: hidden;
}
.app-sidebar[aria-hidden="false"] {
    visibility: visible;
}
