/* ── Design tokens: 简洁扁平 ── */
:root {
  --kp-primary: #07c160;
  --kp-primary-hover: #06ad56;
  --kp-primary-soft: #e8f8ef;
  --kp-accent: #576b95;
  --kp-danger: #fa5151;
  --kp-success: #07c160;
  --kp-warning: #ffc300;
  --kp-bg: #ededed;
  --kp-surface: #ffffff;
  --kp-text: #191919;
  --kp-text-secondary: #888888;
  --kp-muted: #b2b2b2;
  --kp-border: #e5e5e5;
  --kp-radius: 8px;
  --kp-radius-sm: 6px;
  --kp-shadow: none;
  --kp-shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.06);
  --kp-header-height: 50px;
  --kp-content-max: 1080px;
}

[v-cloak] { display: none !important; }

/* ── Bootstrap overrides ── */
.btn {
  border-radius: var(--kp-radius-sm);
  font-weight: 500;
  box-shadow: none !important;
}

.btn-primary {
  --bs-btn-bg: var(--kp-primary);
  --bs-btn-border-color: var(--kp-primary);
  --bs-btn-hover-bg: var(--kp-primary-hover);
  --bs-btn-hover-border-color: var(--kp-primary-hover);
  --bs-btn-active-bg: var(--kp-primary-hover);
  --bs-btn-active-border-color: var(--kp-primary-hover);
}

.btn-outline-primary {
  --bs-btn-color: var(--kp-primary);
  --bs-btn-border-color: var(--kp-primary);
  --bs-btn-hover-bg: var(--kp-primary-soft);
  --bs-btn-hover-border-color: var(--kp-primary);
  --bs-btn-hover-color: var(--kp-primary);
  --bs-btn-active-bg: var(--kp-primary-soft);
  --bs-btn-active-border-color: var(--kp-primary);
  --bs-btn-active-color: var(--kp-primary);
}

.btn-light {
  --bs-btn-bg: #f7f7f7;
  --bs-btn-border-color: var(--kp-border);
  --bs-btn-color: var(--kp-text);
}

.text-primary { color: var(--kp-primary) !important; }
.bg-primary { background-color: var(--kp-primary) !important; }
.border-primary { border-color: var(--kp-primary) !important; }
.spinner-border.text-primary { color: var(--kp-primary) !important; }

.progress-bar { background-color: var(--kp-primary); }

.form-control,
.form-select {
  border-color: var(--kp-border);
  border-radius: var(--kp-radius-sm);
  font-size: 0.9375rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--kp-primary);
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.12);
}

.alert {
  border-radius: var(--kp-radius-sm);
  border: none;
}

/* ── Base ── */
body {
  background: var(--kp-bg);
  color: var(--kp-text);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
}

.kp-header .container,
.kp-footer .container,
.app-main > .container {
  max-width: var(--kp-content-max);
  width: 100%;
}

/* 管理后台通栏，顶栏与侧栏左缘对齐 */
.app-shell:has(.admin-layout) .kp-header .container {
  max-width: none;
}

/* ── Header & navigation ── */
.kp-header {
  background: var(--kp-surface);
  border-bottom: 1px solid var(--kp-border);
  height: var(--kp-header-height);
  z-index: 1030;
}

.kp-header-inner {
  display: flex;
  align-items: center;
  height: var(--kp-header-height);
  gap: 0.75rem;
}

.kp-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--kp-text);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
}

.kp-brand:hover {
  color: var(--kp-text);
}

.kp-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--kp-primary);
  color: #fff;
  border-radius: 6px;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.kp-brand-name {
  white-space: nowrap;
}

.kp-nav-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.kp-nav-wrap::before,
.kp-nav-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.kp-nav-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--kp-surface) 20%, transparent);
}

.kp-nav-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--kp-surface) 20%, transparent);
}

.kp-nav-wrap--overflow-start::before,
.kp-nav-wrap--overflow-end::after {
  opacity: 1;
}

.kp-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.kp-nav::-webkit-scrollbar {
  display: none;
}

.kp-nav-item {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 0.8rem;
  border-radius: 15px;
  border: 1px solid transparent;
  box-sizing: border-box;
  font-size: 0.8125rem;
  line-height: 1;
  color: var(--kp-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.kp-nav-item:hover {
  color: var(--kp-text);
  background: #f5f5f5;
}

.kp-nav-item.active {
  color: var(--kp-primary);
  background: var(--kp-primary-soft);
  font-weight: 500;
}

.kp-header-end {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 100%;
}

.kp-nav-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 0.85rem;
  border-radius: 15px;
  box-sizing: border-box;
  color: var(--kp-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  border: 1px solid var(--kp-primary);
  white-space: nowrap;
}

.kp-nav-login:hover {
  background: var(--kp-primary-soft);
  color: var(--kp-primary);
}

.kp-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 30px;
  border: 1px solid transparent;
  box-sizing: border-box;
  background: transparent;
  padding: 0 0.35rem 0 0.15rem;
  border-radius: 15px;
  color: var(--kp-text);
  font-size: 0.8125rem;
  line-height: 1;
}

.kp-user-btn:hover,
.kp-user-btn:focus,
.kp-user-btn.show {
  background: #f5f5f5;
  color: var(--kp-text);
}

.kp-user-btn::after {
  margin-left: 0;
  font-size: 0.6rem;
  color: var(--kp-muted);
  vertical-align: middle;
}

.kp-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--kp-primary-soft);
  color: var(--kp-primary);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.kp-user-name {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kp-user-menu {
  border: 1px solid var(--kp-border);
  box-shadow: var(--kp-shadow-lg);
  border-radius: var(--kp-radius);
  padding: 0.25rem;
  margin-top: 0.35rem !important;
}

.kp-user-menu .dropdown-item {
  border-radius: var(--kp-radius-sm);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

/* ── Footer ── */
.kp-footer {
  background: #f7f7f7;
  color: var(--kp-muted);
  padding: 1.25rem 0;
  margin-top: auto;
  font-size: 0.8125rem;
  border-top: 1px solid var(--kp-border);
}

.kp-footer a {
  color: var(--kp-text-secondary);
  text-decoration: none;
}

.kp-footer a:hover { color: var(--kp-primary); }

.kp-footer .brand-icon {
  background: var(--kp-primary);
  color: #fff;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 1rem;
  padding: 0.25rem 0;
}

.page-header-icon {
  display: none;
}

.page-header-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--kp-text);
}

.page-header-sub {
  color: var(--kp-text-secondary);
  font-size: 0.8125rem;
  margin: 0.2rem 0 0;
}

/* ── Cell group (分组白卡片) ── */
.cell-group {
  background: var(--kp-surface);
  border-radius: var(--kp-radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.cell-group-body {
  padding: 1rem 1rem;
}

/* ── Search ── */
.search-section-label {
  font-size: 0.8125rem;
  color: var(--kp-text-secondary);
  margin-bottom: 0.5rem;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
}

.search-bar .search-input {
  flex: 1;
  background: #f7f7f7;
  border: none;
}

.search-bar .search-input:focus {
  background: var(--kp-surface);
  border: 1px solid var(--kp-primary);
}

.hero-banner {
  background: var(--kp-surface);
  color: var(--kp-text);
  border-radius: var(--kp-radius);
  padding: 1rem;
  box-shadow: none;
}

.hero-banner::before { display: none; }

.hero-banner h1 {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.hero-banner p {
  font-size: 0.8125rem;
  color: var(--kp-text-secondary);
  margin-bottom: 0.75rem !important;
  opacity: 1 !important;
}

.hero-search .form-control {
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius-sm);
  padding: 0.55rem 0.75rem;
  box-shadow: none;
  font-size: 0.9375rem;
}

.hero-search .btn-light {
  border-radius: var(--kp-radius-sm);
  font-weight: 500;
  box-shadow: none;
  background: var(--kp-primary);
  color: #fff;
  border-color: var(--kp-primary);
}

.hero-search .btn-light:hover {
  background: var(--kp-primary-hover);
  border-color: var(--kp-primary-hover);
  color: #fff;
}

/* ── Carousel ── */
.home-carousel {
  border-radius: var(--kp-radius);
  overflow: hidden;
  border: none;
  box-shadow: none;
  margin-bottom: 12px !important;
}

.banner-img {
  height: 180px;
  object-fit: cover;
}

.carousel-caption {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45));
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.5rem 1rem 0.75rem;
  text-align: left;
}

.carousel-caption h5 {
  font-weight: 500;
  font-size: 0.9375rem;
  margin: 0;
}

.carousel-indicators [data-bs-target] {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* ── Category pills ── */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--kp-surface);
  border-radius: var(--kp-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 12px !important;
}

.category-pill {
  border: none;
  background: #f7f7f7;
  color: var(--kp-text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--kp-radius-sm);
  font-size: 0.8125rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.category-pill:hover {
  background: var(--kp-primary-soft);
  color: var(--kp-primary);
}

.category-pill.active {
  background: var(--kp-primary);
  color: #fff;
  box-shadow: none;
}

/* ── Course cards ── */
.course-card {
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
  overflow: hidden;
  transition: background 0.15s;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.course-card:hover {
  transform: none;
  box-shadow: none;
  background: #fafafa;
}

.course-card-cover-wrap {
  position: relative;
  overflow: hidden;
}

.course-cover {
  height: 140px;
  object-fit: cover;
  width: 100%;
  transition: none;
}

.course-card:hover .course-cover {
  transform: none;
}

.course-card-category {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--kp-text-secondary);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.course-card-body {
  padding: 0.75rem 1rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card-summary {
  font-size: 0.8125rem;
  color: var(--kp-text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.course-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--kp-border);
}

.price-tag {
  color: var(--kp-danger);
  font-weight: 600;
  font-size: 1.0625rem;
}

.price-tag small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--kp-muted);
}

.rating-badge {
  color: var(--kp-warning);
  font-size: 0.8125rem;
  font-weight: 400;
}

/* ── Surface cards ── */
.surface-card {
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
  box-shadow: none;
  overflow: hidden;
}

.surface-card-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--kp-border);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--kp-text);
  background: var(--kp-surface);
  border-radius: 0;
}

/* ── Course detail ── */
.course-hero {
  position: relative;
  border-radius: var(--kp-radius);
  overflow: hidden;
  height: 200px;
  margin-bottom: 12px;
  box-shadow: none;
  background: #f7f7f7;
}

.course-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.course-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 55%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  color: #fff;
}

.course-hero-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
}

.section-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--kp-text-secondary);
  margin-bottom: 0.5rem;
  padding-bottom: 0;
  border-bottom: none;
  display: block;
}

.purchase-panel {
  border-radius: var(--kp-radius);
  border: none;
  box-shadow: none;
  overflow: hidden;
  background: var(--kp-surface);
}

.purchase-panel.sticky-top {
  top: calc(var(--kp-header-height) + 1rem);
}

.price-tag-lg {
  font-size: 1.75rem;
}

.price-tag-xl {
  font-size: 2rem;
}

.price-tag-md {
  font-size: 1.25rem;
}

.price-tag-sm {
  font-size: 1rem;
}

.purchase-panel-header {
  background: var(--kp-surface);
  color: var(--kp-text);
  padding: 1rem;
  text-align: center;
  border-bottom: 1px solid var(--kp-border);
}

.purchase-panel-header .price-tag {
  color: var(--kp-danger);
}

.purchase-panel-header .price-tag.text-white {
  color: var(--kp-danger) !important;
}

.purchase-panel-header .text-white,
.purchase-panel-header a.text-white {
  color: var(--kp-accent) !important;
  opacity: 1 !important;
}

.purchase-panel-body {
  padding: 1rem;
  background: var(--kp-surface);
}

/* ── Chapter list ── */
.chapter-list .list-group-item {
  border-color: var(--kp-border);
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  transition: background 0.1s;
  border-left: none;
  border-right: none;
  gap: 0.5rem;
}

.chapter-list .list-group-item > span:first-child {
  min-width: 0;
}

.chapter-list .list-group-item:first-child {
  border-top: none;
}

.chapter-list .list-group-item:hover {
  background: #fafafa;
}

.chapter-list .list-group-item.active {
  background: var(--kp-primary-soft);
  border-color: var(--kp-border);
  color: var(--kp-primary);
  font-weight: 500;
}

/* ── Learn page ── */
.learn-sidebar {
  position: sticky;
  top: calc(var(--kp-header-height) + 0.75rem);
}

.learn-content {
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
  padding: 1.25rem 1.5rem;
  min-height: 480px;
  line-height: 1.75;
  box-shadow: none;
}

.learn-content h1,
.learn-content h2,
.learn-content h3 {
  margin-top: 1.5rem;
  font-weight: 600;
  font-size: 1.0625rem;
}

.learn-content pre {
  background: #f7f7f7;
  border: none;
  padding: 0.85rem 1rem;
  border-radius: var(--kp-radius-sm);
  overflow-x: auto;
  font-size: 0.8125rem;
}

.learn-content code {
  background: #f7f7f7;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--kp-danger);
}

.learn-nav-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--kp-border);
}

.learn-chapter-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--kp-border);
}

.learn-chapter-heading h4 {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  word-break: break-word;
  font-weight: 600;
}

.learn-chapter-heading .learn-progress {
  margin-left: auto;
  white-space: nowrap;
}

/* ── Pay / checkout ── */
.checkout-card {
  max-width: 400px;
  margin: 0 auto;
  border-radius: var(--kp-radius);
  overflow: hidden;
  border: none;
  box-shadow: none;
  background: var(--kp-surface);
}

.checkout-header {
  background: var(--kp-surface);
  color: var(--kp-text);
  padding: 1.25rem 1rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--kp-border);
}

.checkout-body {
  padding: 1.25rem 1rem 1.5rem;
  background: var(--kp-surface);
}

.pay-qr-wrap {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f7f7;
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius);
}

.coupon-input-group {
  border-radius: var(--kp-radius-sm);
  overflow: hidden;
  border: 1px solid var(--kp-border);
}

.coupon-input-group .form-control {
  border: none;
  background: #f7f7f7;
}

.coupon-input-group .btn {
  border-radius: 0;
}

/* ── Auth page ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kp-bg);
  padding: 1.5rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--kp-surface);
  border-radius: var(--kp-radius);
  box-shadow: none;
  overflow: hidden;
}

.auth-card-header {
  background: var(--kp-surface);
  padding: 2rem 1.5rem 0.5rem;
  text-align: center;
  border-bottom: none;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--kp-primary);
  border-radius: 10px;
  color: #fff;
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
}

.auth-card-body {
  padding: 1rem 1.5rem 2rem;
}

.auth-tabs .nav-link {
  color: var(--kp-muted);
  font-weight: 500;
  font-size: 0.9375rem;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 1.25rem;
}

.auth-tabs .nav-link.active {
  color: var(--kp-primary);
  border-bottom-color: var(--kp-primary);
  background: transparent;
}

.auth-card .input-group-text {
  background: #f7f7f7;
  border-color: var(--kp-border);
  color: var(--kp-muted);
}

/* ── Coupons ── */
.coupon-ticket {
  display: flex;
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
  overflow: hidden;
  box-shadow: none;
  transition: none;
}

.coupon-ticket:hover {
  transform: none;
  box-shadow: none;
}

.coupon-ticket-left {
  background: var(--kp-primary-soft);
  color: var(--kp-primary);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 110px;
  text-align: center;
  position: relative;
  border-right: 1px dashed var(--kp-border);
}

.coupon-ticket-left::after {
  display: none;
}

.coupon-ticket-value {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
}

.coupon-ticket-code {
  font-size: 0.6875rem;
  opacity: 0.75;
  margin-top: 0.2rem;
  letter-spacing: 0.04em;
}

.coupon-ticket-right {
  flex: 1;
  min-width: 0;
  padding: 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.coupon-ticket-right > div:first-child {
  min-width: 0;
  flex: 1;
}

/* ── Library ── */
.library-card {
  display: flex;
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
  overflow: hidden;
  box-shadow: none;
  transition: none;
}

.library-card:hover {
  transform: none;
  box-shadow: none;
}

.library-card-cover {
  width: 120px;
  min-height: 100px;
  object-fit: cover;
  flex-shrink: 0;
}

.library-card-body {
  padding: 0.85rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.progress-thin {
  height: 4px;
  border-radius: 2px;
  background: #e5e5e5;
}

.progress-thin .progress-bar {
  border-radius: 2px;
}

/* ── Tables ── */
.table-card {
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
  overflow: hidden;
  box-shadow: none;
}

.table-card .table {
  margin: 0;
}

.table-card thead th {
  background: #fafafa;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--kp-text-secondary);
  border-bottom: 1px solid var(--kp-border);
  padding: 0.65rem 1rem;
}

.table-card tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-color: var(--kp-border);
  font-size: 0.875rem;
}

.table-card tbody tr:hover {
  background: #fafafa;
}

.order-thumb {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  border: none;
  display: block;
  background: #f0f0f0;
  flex-shrink: 0;
}

/* ── Admin media ── */
.admin-media-card {
  background: var(--kp-surface);
  border-radius: var(--kp-radius);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.admin-media-thumb {
  width: 100%;
  height: 120px;
  background: #f0f0f0;
  overflow: hidden;
}

.admin-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-media-body {
  padding: 0.85rem 1rem 1rem;
}

.admin-preview-box {
  margin-top: 0.5rem;
  width: 160px;
  height: 90px;
  border-radius: var(--kp-radius-sm);
  overflow: hidden;
  background: #f0f0f0;
  border: 1px solid var(--kp-border);
}

.admin-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-preview-box--banner {
  width: 100%;
  max-width: 360px;
  height: 100px;
}

.course-cover,
.library-card-cover,
.banner-img {
  background: #f0f0f0;
  display: block;
}

/* ── Status badges ── */
.status-badge-pending { background: #fff8e6; color: #b8860b; font-weight: 500; }
.status-badge-paid { background: var(--kp-primary-soft); color: var(--kp-primary); font-weight: 500; }
.status-badge-expired { background: #fff0f0; color: var(--kp-danger); font-weight: 500; }

.badge {
  font-weight: 500;
  padding: 0.3em 0.6em;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* ── Reviews ── */
.star-rating {
  color: var(--kp-warning);
  letter-spacing: 1px;
}

.review-card {
  border: none;
  border-bottom: 1px solid var(--kp-border);
  border-radius: 0;
  box-shadow: none;
}

.review-card:last-child {
  border-bottom: none;
}

.review-card:hover {
  box-shadow: none;
  background: #fafafa;
}

/* ── Admin ── */
.admin-layout {
  background: var(--kp-bg);
  min-height: calc(100vh - var(--kp-header-height));
}

.admin-sidebar {
  min-height: calc(100vh - var(--kp-header-height));
  background: var(--kp-surface);
  border-right: 1px solid var(--kp-border);
  padding: 0.75rem 0.5rem;
}

.admin-nav-group {
  padding: 0.85rem 0.85rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--kp-muted);
}

.admin-menu-title {
  padding: 0.85rem 0.85rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--kp-muted);
}

.admin-nav-group:first-of-type {
  padding-top: 0.85rem;
}

.admin-sidebar .list-group-item {
  border: none;
  border-radius: var(--kp-radius-sm) !important;
  margin-bottom: 2px;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--kp-text-secondary);
  padding: 0.6rem 0.85rem;
}

.admin-sidebar .list-group-item:hover {
  background: #f7f7f7;
  color: var(--kp-text);
}

.admin-sidebar .list-group-item.active {
  background: var(--kp-primary-soft);
  color: var(--kp-primary);
  font-weight: 500;
}

.admin-content {
  padding: 1rem 1.25rem 2rem;
}

.admin-panel-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ── Empty & loading ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--kp-text-secondary);
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
}

.empty-state i {
  color: var(--kp-muted);
}

.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--kp-text-secondary);
}

/* ── Modal ── */
.modal-content {
  border: none;
  border-radius: var(--kp-radius);
  box-shadow: var(--kp-shadow-lg);
}

.modal-header {
  border-bottom-color: var(--kp-border);
  padding: 1rem 1.25rem;
}

.modal-body { padding: 1rem 1.25rem; }

.modal-footer {
  border-top-color: var(--kp-border);
  padding: 0.75rem 1.25rem;
}

.markdown-body ul {
  padding-left: 1.25rem;
}

/* ── Member ── */
.member-status-card {
  background: var(--kp-surface);
  border-radius: var(--kp-radius);
  padding: 1rem 1.15rem;
  color: var(--kp-text);
  box-shadow: none;
  border-left: 3px solid var(--kp-primary);
}

.member-status-card .fw-bold.text-white {
  color: var(--kp-text) !important;
}

.member-status-card .opacity-75 {
  color: var(--kp-text-secondary) !important;
  opacity: 1 !important;
}

.member-badge-lg {
  width: 44px;
  height: 44px;
  background: var(--kp-primary-soft);
  color: var(--kp-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.member-plan-card {
  background: var(--kp-surface);
  border: none;
  border-radius: var(--kp-radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
  position: relative;
  box-shadow: none;
  transition: none;
  height: 100%;
  overflow: hidden;
}

.member-plan-card:hover {
  transform: none;
  box-shadow: none;
}

.member-plan-featured {
  border: 1px solid var(--kp-primary);
}

.member-plan-ribbon {
  position: absolute;
  top: 10px;
  right: -24px;
  background: var(--kp-warning);
  color: var(--kp-text);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 3px 28px;
  transform: rotate(45deg);
}

.member-plan-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.member-plan-price {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--kp-danger);
  margin: 0.75rem 0;
}

.member-plan-period {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--kp-text-secondary);
}

.member-plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  text-align: left;
  font-size: 0.8125rem;
  color: var(--kp-text-secondary);
}

.member-plan-features li {
  padding: 0.3rem 0;
}

/* ── Utilities ── */
.text-secondary { color: var(--kp-text-secondary) !important; }

.app-main .container.py-4 {
  padding-top: 0.75rem !important;
  padding-bottom: 1.5rem !important;
}

.row.g-4 {
  --bs-gutter-y: 0.75rem;
  --bs-gutter-x: 0.75rem;
}

.row.g-4 > [class*="col-"] > .course-card,
.row.g-4 > [class*="col-"] > .library-card {
  height: 100%;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .learn-sidebar {
    position: static;
    margin-bottom: 0.75rem;
  }

  .learn-sidebar .chapter-list {
    max-height: 220px;
    overflow-y: auto;
  }

  .learn-content {
    min-height: 0;
    padding: 1rem 1.15rem;
  }

  .purchase-panel.sticky-top {
    position: static;
  }
}

@media (max-width: 768px) {
  .banner-img { height: 140px; }
  .course-hero { height: 160px; }
  .course-hero-title { font-size: 1rem; }
  .library-card { flex-direction: row; }
  .library-card-cover { width: 100px; height: auto; min-height: 90px; }
  .admin-content { padding: 0.75rem; }
  .admin-sidebar {
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--kp-border);
    padding: 0.55rem 0.75rem;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky;
    top: var(--kp-header-height);
    z-index: 1020;
  }
  .admin-sidebar::-webkit-scrollbar {
    display: none;
  }
  .admin-menu-title,
  .admin-nav-group {
    display: none;
  }
  .admin-sidebar .list-group {
    display: contents;
  }
  .admin-sidebar .list-group-item {
    flex-shrink: 0;
    margin-bottom: 0;
    white-space: nowrap;
    padding: 0.4rem 0.75rem;
    border-radius: 15px !important;
    font-size: 0.8125rem;
  }
  .admin-sidebar .list-group-item i.me-2 {
    margin-right: 0.35rem !important;
  }
  .kp-brand-name { display: none; }
  .kp-user-name { display: none; }
  .kp-header-inner { gap: 0.5rem; }
  .kp-nav-item { padding: 0 0.65rem; }
  .coupon-ticket {
    flex-direction: column;
  }
  .coupon-ticket-left {
    min-width: 0;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-right: none;
    border-bottom: 1px dashed var(--kp-border);
  }
  .member-plan-price {
    font-size: 1.5rem;
  }
}

@media (min-width: 1400px) {
  :root {
    --kp-content-max: 1200px;
  }
}
