/* ============================================================
   全局变量 & Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #4f6ef7;
  --primary-dark: #3a57e8;
  --primary-light:#eef0fe;
  --danger:       #f04747;
  --success:      #43b581;
  --warning:      #faa61a;
  --text:         #1a1d23;
  --text-sub:     #6b7280;
  --border:       #e5e7eb;
  --bg:           #f3f4f8;
  --white:        #ffffff;
  --sidebar-w:    220px;
  --topbar-h:     56px;
  --radius:       8px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
}

html, body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); width: 100%; height: 100%; min-height: 100%; overflow-x: hidden; }
#app { min-height: 100%; min-height: 100vh; width: 100%; display: flex; flex-direction: column; overflow-x: hidden; }

a { color: var(--primary); text-decoration: none; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; font-size: 14px; outline: none; }
button { cursor: pointer; border: none; background: none; }
svg { display: inline-block; vertical-align: middle; }

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #ffffff;
}

/* 顶部 Logo 栏 */
.login-topbar {
  height: auto;
  min-height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.login-topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 32px;
}
.login-topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-topbar-brand #login-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.login-brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}
.login-brand-text-logo {
  height: 36px;
  width: auto;
  max-width: 160px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}
.login-brand-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}
.login-brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* 移动端专用 logo + 标题（桌面端隐藏） */
.login-mobile-header {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 860px;
}
.login-mobile-logo {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
  min-width: 0;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
  display: block;
}
.login-mobile-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

/* 主体 */
.login-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: #f5f6fa;
}
.login-container {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 860px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,.08);
  overflow: hidden;
  min-height: 400px;
}

/* 左侧插图 */
.login-illustration {
  flex: 1;
  background: linear-gradient(135deg, #4f8ef7 0%, #1db8e8 100%);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  min-width: 0;
  overflow: hidden;
}
.login-illus-inner {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: stretch;
}
.login-illus-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 右侧表单 */
.login-form-wrap {
  width: 340px;
  flex-shrink: 0;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-welcome { margin-bottom: 32px; }
.login-welcome-title { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.login-welcome-sub { font-size: 13px; color: var(--text-sub); }

/* 合并输入框组 */
.login-input-group {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--white);
  transition: border-color .15s;
}
.login-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,.10);
}
.login-input-row {
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 0;
}
/* 输入框图标：严格固定尺寸，防止全局 svg 样式撑大 */
.s-input-icon {
  display: block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
  color: #9ca3af;
  pointer-events: none;
  overflow: hidden;
}
.login-group-input {
  flex: 1;
  height: 48px;
  border: none;
  outline: none;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  line-height: 48px;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}
.login-group-input::placeholder { color: #9ca3af; }
.login-input-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* 登录按钮 */
.s-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 14px;
  font-weight: 500; cursor: pointer; transition: all .15s;
  border: 1.5px solid transparent; white-space: nowrap;
}
.s-btn-login {
  background: #29a8e8;
  color: #ffffff;
  border-color: #29a8e8;
  font-size: 16px;
  font-weight: 600;
  height: 46px;
  border-radius: 8px;
  margin-top: 12px;
  transition: background .15s, opacity .15s;
}
.s-btn-login:hover { background: #1b90cc; border-color: #1b90cc; }
.s-btn-login:disabled { opacity: .6; cursor: not-allowed; }
.s-btn-block { width: 100%; }

/* 底部版权 */
.login-footer {
  flex-shrink: 0;
  padding: 18px 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-sub);
  background: #f5f6fa;
  border-top: 1px solid var(--border);
}

/* 移动端响应式 */
@media (max-width: 800px) {
  .login-illustration { display: none; }
  .login-container {
    max-width: 100%;
    min-height: unset;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
  }
  .login-form-wrap { width: 100%; padding: 36px 28px; border-radius: 12px; }
  .login-topbar-inner { padding: 10px 20px; justify-content: center; }
  .login-brand-block { flex-wrap: nowrap; max-width: 100%; overflow: hidden; }
  .login-brand-text-logo { height: 30px; }
  .login-body { padding: 20px 16px 24px; }
  .login-mobile-header { display: flex; gap: 10px; margin-bottom: 20px; max-width: 420px; }
  .login-mobile-logo { width: 36px; height: 36px; max-width: 36px; max-height: 36px; }
  .login-mobile-title { font-size: 15px; }
}
@media (max-width: 580px) {
  .login-topbar-inner { padding: 8px 16px; min-height: 54px; justify-content: center; }
  .login-brand-text-logo { height: 26px; }
  .login-brand-divider { height: 16px; }
  .login-brand-name { font-size: 12px; }
  .login-body { padding: 12px 12px 20px; }
  .login-mobile-header { gap: 8px; margin-bottom: 16px; }
  .login-mobile-logo { width: 28px; height: 28px; max-width: 28px; max-height: 28px; }
  .login-mobile-title { font-size: 13px; }
  .login-form-wrap { padding: 28px 20px; }
  .login-welcome-title { font-size: 20px; }
  .login-welcome { margin-bottom: 24px; }
}
@media (max-width: 380px) {
  .login-form-wrap { padding: 24px 16px; }
  .login-brand-text-logo { height: 22px; }
}
@supports (-webkit-touch-callout: none) {
  .login-page { min-height: -webkit-fill-available; }
}

/* ============================================================
   布局
   ============================================================ */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .25s;
  overflow: hidden;
}
.sidebar.collapsed { width: 60px; }
.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-logo img { width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }
.sidebar-logo-text {
  height: 26px;
  max-height: 26px;
  width: auto;
  max-width: 120px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}
.sidebar-logo-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}
.sidebar-logo-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-logo-divider,
.sidebar.collapsed .sidebar-logo-name { display: none; }
.sidebar-nav { padding: 8px 0; flex: 1; overflow-y: auto; overflow-x: hidden; }

/* 侧边栏底部用户区 */
.sidebar-user {
  border-top: 1px solid var(--border);
  padding: 10px 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.sidebar-user-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-sub {
  font-size: 11px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 退出按钮 */
.sidebar-logout-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-sub);
  transition: background .15s, color .15s;
  cursor: pointer;
  border: none;
  background: none;
}
.sidebar-logout-btn:hover { background: #fee2e2; color: var(--danger); }
.sidebar-logout-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* 头像：始终 flex-shrink: 0，保证收起时不被压缩 */
.sidebar-user .user-avatar {
  flex-shrink: 0;
}

/* 收起态：只显示头像，隐藏文字和退出按钮 */
.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: 10px 0;
}
.sidebar.collapsed .sidebar-user-info {
  flex: 0 0 auto;
  justify-content: center;
}
.sidebar.collapsed .sidebar-user-text { display: none; }
.sidebar.collapsed .sidebar-logout-btn { display: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-sub);
  white-space: nowrap;
  transition: background .15s, color .15s;
  margin: 2px 8px;
  border-radius: 6px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item span { font-size: 13.5px; overflow: hidden; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* 主内容区 */
.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: flex-end; }

/* topbar 移动端 logo（仅移动端显示，侧边栏收起时可见） */
.topbar-mobile-logo {
  display: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}
.topbar-brand-logo {
  height: 28px;
  max-height: 28px;
  width: auto;
  max-width: 140px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}
.topbar-brand-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}
.topbar-brand-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.dropdown-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  z-index: 100;
  padding: 4px 0;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  padding: 9px 16px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ============================================================
   通用组件
   ============================================================ */
/* 卡片 */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-label { font-size: 13px; color: var(--text-sub); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 20px; height: 20px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-default { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-default:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: .9; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; display: flex; }
.btn-icon { padding: 6px; border-radius: 6px; color: var(--text-sub); transition: background .15s, color .15s; }
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* 搜索栏 */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-bar input, .search-bar select {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13.5px;
  background: var(--white);
  color: var(--text);
}
.search-bar input:focus, .search-bar select:focus { border-color: var(--primary); }
.search-bar input { width: 200px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg); }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; white-space: nowrap; }
th { font-weight: 600; color: var(--text-sub); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: #fafafa; }
.td-actions { display: flex; gap: 6px; }

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination span { font-size: 13px; color: var(--text-sub); }
.page-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 表单 */
.form-item {
  margin-bottom: 16px;
}
.form-item label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-item label.required::after {
  content: ' *';
  color: var(--danger);
}
.form-control {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { height: auto; padding: 8px 10px; resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* 徽标 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-default { background: var(--bg); color: var(--text-sub); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--white);
  border-radius: 10px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal.modal-lg { width: 780px; }
.modal.modal-xl { width: 960px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  color: white;
  animation: slideIn .25s ease;
  min-width: 200px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info    { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* 标签切换 */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-sub);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* 上传区域 */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-sub);
}
.upload-area:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.upload-area svg { width: 32px; height: 32px; margin-bottom: 8px; }
.upload-area p { font-size: 13px; margin-top: 4px; }
.upload-preview { width: 100%; max-height: 160px; object-fit: cover; border-radius: 6px; margin-top: 8px; }

/* 进度条 */
.progress-bar { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }

/* 课程结构树 */
.course-structure { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chapter-item { border-bottom: 1px solid var(--border); }
.chapter-item:last-child { border-bottom: none; }
.chapter-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  gap: 8px;
  background: var(--bg);
  cursor: pointer;
}
.chapter-header:hover { background: #ebebeb; }
.chapter-lessons { padding: 0; }
.lesson-item {
  display: flex;
  align-items: center;
  padding: 9px 14px 9px 36px;
  gap: 10px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.lesson-item:hover { background: var(--bg); }
.lesson-type-icon { width: 20px; height: 20px; color: var(--text-sub); flex-shrink: 0; }
.lesson-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-duration { font-size: 12px; color: var(--text-sub); }
.lesson-actions { display: flex; gap: 4px; }

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-sub);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* 确认对话框 */
.confirm-dialog { text-align: center; padding: 10px 0; }
.confirm-dialog svg { width: 40px; height: 40px; color: var(--warning); margin-bottom: 12px; }
.confirm-dialog h3 { font-size: 16px; margin-bottom: 8px; }
.confirm-dialog p { font-size: 13.5px; color: var(--text-sub); }

/* 课程封面 */
.course-cover {
  width: 80px; height: 52px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
  flex-shrink: 0;
}
.course-cover-placeholder {
  width: 80px; height: 52px;
  background: var(--bg);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--border);
  flex-shrink: 0;
}

/* 分类树 */
.cat-tree-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  gap: 8px;
  cursor: default;
}
.cat-tree-item:hover { background: var(--bg); }
.cat-indent { display: inline-block; width: 20px; flex-shrink: 0; }

/* 富文本内容预览 */
.rich-content { font-size: 14px; line-height: 1.7; color: var(--text); }
.rich-content p { margin-bottom: 8px; }
.rich-content h1,.rich-content h2,.rich-content h3 { margin-bottom: 10px; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: calc(-1 * var(--sidebar-w)); z-index: 150;
    height: 100%; transition: left .25s;
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  /* 移动端侧边栏展开时恢复完整底部用户区 */
  .sidebar.mobile-open .sidebar-user { justify-content: flex-start; padding: 10px 8px; }
  .sidebar.mobile-open .sidebar-user-info { flex: 1; justify-content: flex-start; }
  .sidebar.mobile-open .sidebar-user-text { display: flex !important; }
  .sidebar.mobile-open .sidebar-logout-btn { display: flex !important; }
  /* 移动端 topbar logo：收起时显示，展开时隐藏 */
  .topbar-mobile-logo { display: block; }
  /* topbar brand 移动端适配：缩小尺寸 */
  .topbar-brand { gap: 8px; }
  .topbar-brand-logo { height: 22px; max-height: 22px; max-width: 90px; }
  .topbar-brand-divider { height: 14px; }
  .topbar-brand-name { font-size: 12px; }
  /* 侧边栏打开时背景遮罩 */
  .sidebar-mask {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.35); z-index: 149;
  }
  .sidebar-mask.show { display: block; }
  .content { padding: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .search-bar input { width: 100%; }
  .modal.modal-lg, .modal.modal-xl { width: 95vw; }
  .layout { height: 100vh; height: -webkit-fill-available; }
  html, body { height: 100%; min-height: 100%; overflow-x: hidden; }
  #app { min-height: 100%; min-height: -webkit-fill-available; overflow-x: hidden; }
  .login-page { min-height: 100vh; min-height: -webkit-fill-available; }
}

/* 加载动画 */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; align-items: center; justify-content: center; height: 200px; }

/* 视频上传进度 */
.upload-progress-wrap { margin-top: 10px; display: none; }
.upload-percent { font-size: 13px; color: var(--text-sub); margin-top: 4px; text-align: right; }

/* iOS Safari 兼容 */
@supports (-webkit-touch-callout: none) {
  html, body { height: -webkit-fill-available; }
  #app { min-height: -webkit-fill-available; }
  .login-page { min-height: -webkit-fill-available; }
}
