/* ============ Design Tokens ============ */
:root {
  --bg: #FFF9F3;
  --bg-elev: #FFFFFF;
  --bg-sunk: #FCEDE0;
  --ink: #1A0B2E;
  --ink-2: #3D2A56;
  --ink-3: #7B6A8F;
  --ink-4: #B5A8C4;
  --line: #F0E3F2;
  --line-2: #E0CCE8;

  --brand: #FF5E7E;      /* playful coral-pink */
  --brand-ink: #FFFFFF;
  --brand-soft: #FFE5EC;
  --brand-hover: #F43F68;

  --accent: #7C3AED;     /* vibrant purple */
  --accent-2: #FDB022;   /* sunny yellow */
  --accent-3: #22D3A6;   /* mint */
  --ok: #10B981;
  --warn: #F59E0B;
  --danger: #EF4444;

  --shadow-sm: 0 1px 2px rgba(14, 20, 40, .06), 0 1px 1px rgba(14, 20, 40, .04);
  --shadow-md: 0 4px 12px rgba(14, 20, 40, .08), 0 1px 2px rgba(14, 20, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(14, 20, 40, .18), 0 4px 12px rgba(14, 20, 40, .06);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --font-sans: "IBM Plex Sans Thai", "Sarabun", "Inter", system-ui, -apple-system, sans-serif;
  --font-num: "IBM Plex Sans", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ============ Top nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 28px;
  padding: 14px 28px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  cursor: pointer;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #FF5E7E 0%, #7C3AED 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 12px rgba(255,94,126,.4);
  transform: rotate(-4deg);
  transition: transform .2s;
}
.brand:hover .brand-mark { transform: rotate(4deg) scale(1.05); }
.brand-name {
  display: flex; flex-direction: column; line-height: 1.1;
}
.brand-name small {
  font-size: 10px; font-weight: 600; color: var(--brand);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-link {
  padding: 8px 14px; border-radius: 8px;
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.nav-link:hover { background: var(--bg-sunk); color: var(--ink); }
.nav-link.active { color: var(--brand); background: var(--brand-soft); }
.nav-spacer { flex: 1; }
.nav-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-sunk); border: 1px solid transparent;
  padding: 8px 14px; border-radius: 10px;
  width: 320px; color: var(--ink-3);
  transition: all .15s;
}
.nav-search:focus-within { background: #fff; border-color: var(--line-2); }
.nav-search input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 14px; color: var(--ink); font-family: inherit;
}
.nav-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border-radius: 100px;
  background: var(--bg-sunk); cursor: pointer;
  font-size: 13px; font-weight: 500;
}
.nav-user-wrap { position: relative; }
.nav-user-chev { font-size: 10px; color: var(--ink-3); margin-left: -2px; }
.nav-user:hover { background: #F1F3F5; }
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 280px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  padding: 10px; z-index: 200;
  animation: popIn .15s ease-out;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } }
.user-menu-head { display: flex; gap: 12px; align-items: center; padding: 8px 10px; }
.user-menu-name { font-weight: 700; font-size: 14px; }
.user-menu-email { font-size: 12px; color: var(--ink-3); }
.user-menu-sep { height: 1px; background: var(--line); margin: 6px 2px; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border-radius: 8px;
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  text-align: left;
}
.user-menu-item:hover { background: var(--bg-sunk); }
.user-menu-item.danger { color: #E11D48; }
.user-menu-item.danger:hover { background: #FFF0F3; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #FDB022, #FF5E7E);
  color: #fff; display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(255,94,126,.3);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #FF5E7E, #F43F68);
  color: var(--brand-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 4px 12px rgba(255,94,126,.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 6px 18px rgba(255,94,126,.5);
}
.btn-secondary {
  background: #fff; color: var(--ink); border-color: var(--line-2);
}
.btn-secondary:hover { background: var(--bg-sunk); border-color: var(--ink-4); }
.btn-ghost {
  background: transparent; color: var(--ink-2);
}
.btn-ghost:hover { background: var(--bg-sunk); color: var(--ink); }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
  width: 36px; height: 36px; padding: 0; justify-content: center;
}

/* ============ Page container ============ */
.page {
  max-width: 1240px; margin: 0 auto;
  padding: 28px;
  animation: pageFade .25s ease-out;
}
@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-3);
  margin-bottom: 16px;
}
.breadcrumbs .crumb { cursor: pointer; }
.breadcrumbs .crumb:hover { color: var(--ink); }
.breadcrumbs .sep { color: var(--ink-4); }
.breadcrumbs .now { color: var(--ink); font-weight: 500; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 28px;
}
.page-title {
  font-size: 32px; font-weight: 800; letter-spacing: -0.02em;
  margin: 0 0 6px 0;
}
.page-sub {
  font-size: 15px; color: var(--ink-3); margin: 0;
}

/* ============ Hero ============ */
.hero {
  display: grid; grid-template-columns: 1fr 380px; gap: 32px;
  background:
    radial-gradient(circle at 15% 20%, rgba(253,176,34,.35), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(34,211,166,.3), transparent 50%),
    linear-gradient(135deg, #FF5E7E 0%, #7C3AED 100%);
  color: #fff;
  border-radius: 24px;
  padding: 44px 52px;
  margin-bottom: 32px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 12% 15%, rgba(255,255,255,.18) 2px, transparent 2px),
    radial-gradient(circle at 88% 22%, rgba(255,255,255,.12) 3px, transparent 3px),
    radial-gradient(circle at 30% 85%, rgba(255,255,255,.15) 2px, transparent 2px);
  background-size: 80px 80px, 120px 120px, 100px 100px;
  pointer-events: none;
}
.hero-float {
  position: absolute; font-size: 42px;
  animation: float 4s ease-in-out infinite;
  pointer-events: none;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.2));
}
.hero-float.f1 { top: 18%; right: 48%; animation-delay: 0s; }
.hero-float.f2 { bottom: 18%; right: 42%; animation-delay: 1.5s; font-size: 32px; }
.hero-float.f3 { top: 12%; right: 10%; animation-delay: 2.5s; font-size: 28px; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}
.hero-label {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.2); backdrop-filter: blur(10px);
  padding: 7px 14px; border-radius: 100px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,.25);
  position: relative;
}
.hero-title {
  font-size: 44px; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.025em; margin: 0 0 16px 0;
  position: relative;
}
.hero-title .hl {
  background: linear-gradient(90deg, #FDB022, #22D3A6);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}
.hero-desc {
  font-size: 16px; line-height: 1.6; opacity: .85;
  max-width: 520px; margin: 0 0 24px 0;
  position: relative;
}
.hero-stats {
  display: flex; gap: 28px;
  position: relative;
}
.hero-stat .num { font-size: 24px; font-weight: 700; font-family: var(--font-num); }
.hero-stat .lbl { font-size: 12px; opacity: .7; text-transform: uppercase; letter-spacing: 0.05em; }
.hero-pills {
  display: flex; flex-wrap: wrap; gap: 10px;
  position: relative; margin-top: 4px;
}
.hero-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 100px;
  font-size: 13px; line-height: 1;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.15);
  transition: all .25s ease;
}
.hero-pill:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,215,0,.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255,107,107,.25);
}
.hero-pill-ic { font-size: 15px; }
.hero-pill b { font-weight: 800; font-size: 14px; }
.hero-pill-sub { opacity: .8; font-size: 12px; font-weight: 600; }
.hero-side {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.hero-card {
  background: rgba(255,255,255,.08); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 16px; padding: 24px;
  width: 100%;
}
.hero-card-title { font-size: 13px; font-weight: 600; opacity: .8; margin-bottom: 12px; }
.hero-progress {
  height: 8px; background: rgba(255,255,255,.12);
  border-radius: 100px; overflow: hidden;
  margin-bottom: 8px;
}
.hero-progress-fill {
  height: 100%; background: linear-gradient(90deg, #0EA5E9, #38BDF8);
  border-radius: 100px;
}
.hero-progress-lbl { font-size: 12px; opacity: .7; }
/* ===== Premium Hero ===== */
.hero-label-glow {
  background: linear-gradient(90deg, rgba(255,215,0,.25), rgba(255,107,107,.25));
  border: 1px solid rgba(255,215,0,.4);
  box-shadow: 0 0 24px rgba(255,215,0,.25), inset 0 0 12px rgba(255,255,255,.08);
  font-weight: 700; letter-spacing: .3px;
}
.hero-title-xl {
  font-size: clamp(34px, 5vw, 58px) !important;
  line-height: 1.1 !important;
  letter-spacing: -.5px;
  text-shadow: 0 4px 24px rgba(0,0,0,.25);
}
.hero-price-line { display: inline-flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: .8em; }
.hero-price-tag {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 4px 18px;
  background: linear-gradient(135deg, #FFD700, #FF6B6B, #FF1493);
  background-size: 200% 200%;
  animation: priceShine 3s ease infinite;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  font-size: 1.1em;
  box-shadow: 0 8px 32px rgba(255,107,107,.5), 0 0 0 2px rgba(255,255,255,.2) inset;
  text-shadow: 0 2px 8px rgba(0,0,0,.3);
  transform: rotate(-1deg);
}
.hero-price-only { font-size: .45em; font-weight: 600; opacity: .9; margin-left: 4px; }
@keyframes priceShine {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero-desc-lg { font-size: 16px !important; line-height: 1.7 !important; max-width: 560px; }

.hero-card-premium {
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,.18), rgba(255,255,255,.06)) !important;
  border: 1px solid rgba(255,255,255,.25) !important;
  box-shadow:
    0 20px 60px rgba(0,0,0,.3),
    0 0 0 1px rgba(255,215,0,.15) inset,
    0 0 80px rgba(255,107,107,.15);
  overflow: visible;
}
.hero-card-premium::before {
  content: ''; position: absolute; inset: -2px;
  background: linear-gradient(135deg, #FFD700, transparent 30%, transparent 70%, #FF6B6B);
  border-radius: inherit;
  z-index: -1; opacity: .6; filter: blur(8px);
  animation: cardGlow 4s ease infinite;
}
@keyframes cardGlow { 0%,100% { opacity: .4; } 50% { opacity: .8; } }
.hero-card-ribbon {
  position: absolute; top: -12px; right: 16px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #FFD700, #FF6B6B);
  color: #fff; font-size: 12px; font-weight: 800;
  border-radius: 100px;
  box-shadow: 0 6px 16px rgba(255,107,107,.5);
  letter-spacing: .3px;
  transform: rotate(2deg);
}
.hero-card-title-lg { font-size: 16px !important; opacity: 1 !important; font-weight: 800 !important; margin-bottom: 14px !important; }

.hero-perks { display: flex; flex-direction: column; gap: 10px; }
.hero-perk {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  transition: all .25s ease;
  position: relative; overflow: hidden;
}
.hero-perk::before {
  content:''; position:absolute; left:-100%; top:0; bottom:0; width:100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
  transition: left .6s ease;
}
.hero-perk:hover { transform: translateX(6px); background: rgba(255,255,255,.14); border-color: rgba(255,215,0,.4); }
.hero-perk:hover::before { left: 100%; }
.hero-perk-ic {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(255,215,0,.3), rgba(255,107,107,.3));
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.hero-perk-tx { display: flex; flex-direction: column; line-height: 1.3; flex: 1; }
.hero-perk-tx b { font-size: 14px; font-weight: 800; }
.hero-perk-tx span { font-size: 11.5px; opacity: .75; }
.hero-perk-check {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #10B981, #34D399);
  color: #fff; font-weight: 900; font-size: 13px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(16,185,129,.5);
}
.btn-cta-glow {
  background: linear-gradient(135deg, #FF6B6B, #FF1493, #FFD700) !important;
  background-size: 200% 200% !important;
  animation: ctaShine 3s ease infinite;
  font-weight: 800 !important;
  letter-spacing: .3px;
  box-shadow: 0 10px 30px rgba(255,107,107,.5), 0 0 0 1px rgba(255,255,255,.2) inset !important;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
}
@keyframes ctaShine {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.btn-cta-glow:hover { transform: translateY(-2px) scale(1.02); }
.hero-card-note {
  margin-top: 12px; text-align: center;
  font-size: 12px; opacity: .85; font-weight: 600;
  color: #FFD700;
}

/* ============ Filter tabs ============ */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.tabs {
  display: flex; gap: 4px;
  background: var(--bg-sunk);
  padding: 4px; border-radius: 10px;
}
.tab {
  padding: 7px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; transition: all .15s;
  border: 0; background: transparent;
}
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.sort-menu {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-3);
}
.sort-menu select {
  border: 1px solid var(--line-2); background: #fff;
  padding: 7px 12px; border-radius: 8px;
  font-size: 13px; font-family: inherit; color: var(--ink);
  cursor: pointer;
}

/* ============ Course cards - GRID ============ */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg-elev);
  border: 2px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  display: flex; flex-direction: column;
  position: relative;
}
.card:hover {
  transform: translateY(-6px) rotate(-0.5deg);
  box-shadow: 0 20px 40px -10px rgba(124,58,237,.25), 0 8px 16px -4px rgba(255,94,126,.2);
  border-color: var(--brand);
}
.card-thumb {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, #FF5E7E, #7C3AED);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.card-thumb iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
  pointer-events: none;
}
.card-thumb-preview-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(239, 68, 68, .95); backdrop-filter: blur(6px);
  padding: 4px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; gap: 4px;
  color: #fff;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(239,68,68,.4);
}
.card-thumb-play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,.25);
  z-index: 2;
  opacity: 0; transition: opacity .2s;
}
.card:hover .card-thumb-play { opacity: 1; }
.card-thumb-play-btn {
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.95);
  display: grid; place-items: center;
  color: #FF5E7E;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
  transform: scale(.9);
  transition: transform .2s;
}
.card:hover .card-thumb-play-btn { transform: scale(1); }
.card-thumb::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.25), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0,0,0,.1), transparent 50%);
  pointer-events: none;
}
.card-thumb .thumb-emoji {
  font-size: 48px;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.25));
  z-index: 1;
  transform: rotate(-5deg);
}
.card:hover .card-thumb .thumb-emoji {
  transform: rotate(5deg) scale(1.1);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.card-thumb .thumb-icon {
  font-size: 44px; opacity: .35;
  font-weight: 800;
  font-family: var(--font-num);
}
.card-thumb-lock {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 13px;
}
.card-thumb-unlocked {
  position: absolute; top: 10px; right: 10px;
  background: var(--ok);
  padding: 4px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.card-thumb-free {
  position: absolute; top: 10px; right: 10px; left: 10px;
  background: linear-gradient(135deg, #10B981, #34D399);
  color: #fff;
  padding: 6px 12px; border-radius: 100px;
  font-size: 11px; font-weight: 800;
  text-align: center;
  box-shadow: 0 4px 14px rgba(16,185,129,.5);
  letter-spacing: .2px;
  animation: freePulse 2s ease infinite;
}
@keyframes freePulse {
  0%,100% { box-shadow: 0 4px 14px rgba(16,185,129,.5); }
  50% { box-shadow: 0 4px 24px rgba(16,185,129,.85); }
}
.card-price-free-badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  background: linear-gradient(135deg, #10B981, #34D399);
  color: #fff;
  border-radius: 100px;
  font-size: 13px; font-weight: 800;
  box-shadow: 0 3px 10px rgba(16,185,129,.4);
}
.card-free-note {
  margin-top: 8px;
  text-align: center;
  font-size: 12px; font-weight: 700;
  color: #10B981;
  padding: 8px;
  background: rgba(16,185,129,.08);
  border: 1px dashed rgba(16,185,129,.4);
  border-radius: 10px;
}
.card-thumb-duration {
  position: absolute; bottom: 10px; left: 10px;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 500;
}
.card-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex; flex-direction: column;
  gap: 8px;
}
.card-ep {
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-family: var(--font-num);
}
.card-title {
  font-size: 15px; font-weight: 600; line-height: 1.35;
  color: var(--ink); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.card-desc {
  font-size: 13px; color: var(--ink-3); line-height: 1.5;
  margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.card-price {
  font-size: 15px; font-weight: 700; color: var(--brand);
  font-family: var(--font-num);
}
.card-price .baht { font-size: 12px; margin-right: 2px; }
.card-price-free {
  font-size: 13px; font-weight: 600; color: var(--ok);
}
.card-cta {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; gap: 4px;
}

/* ============ Course cards - LIST ============ */
.courses-list {
  display: flex; flex-direction: column; gap: 10px;
}
.card-list {
  display: grid; grid-template-columns: 200px 1fr auto;
  gap: 20px; align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  cursor: pointer; transition: all .2s;
}
.card-list:hover { box-shadow: var(--shadow-md); border-color: var(--line-2); }
.card-list .card-thumb {
  aspect-ratio: 16/10;
  border-radius: var(--r-md);
}
.card-list-body {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.card-list-actions {
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  padding-right: 8px;
}

/* ============ Course cards - CAROUSEL ============ */
.courses-carousel-wrap {
  position: relative;
}
.courses-carousel {
  display: flex; gap: 18px;
  overflow-x: auto;
  padding: 4px 4px 16px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.courses-carousel::-webkit-scrollbar { height: 8px; }
.courses-carousel::-webkit-scrollbar-track { background: var(--bg-sunk); border-radius: 10px; }
.courses-carousel::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; }
.courses-carousel > .card {
  flex: 0 0 300px;
  scroll-snap-align: start;
}

/* ============ Course detail page ============ */
.detail-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 32px;
}
.detail-hero {
  background:
    radial-gradient(circle at 85% 30%, rgba(253,176,34,.3), transparent 50%),
    linear-gradient(135deg, #7C3AED 0%, #FF5E7E 100%);
  color: #fff;
  padding: 40px 44px;
  border-radius: 22px;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.detail-hero::after {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,166,.35), transparent 65%);
}
.detail-tag {
  display: inline-flex; padding: 4px 10px; border-radius: 100px;
  background: rgba(255,255,255,.15); font-size: 11px; font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}
.detail-title {
  font-size: 34px; font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.15; margin: 0 0 14px 0;
  max-width: 600px;
  position: relative;
}
.detail-meta {
  display: flex; gap: 20px; flex-wrap: wrap;
  font-size: 13px; opacity: .85;
  position: relative;
}
.detail-meta span { display: inline-flex; align-items: center; gap: 6px; }

.section-title {
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  margin: 28px 0 14px 0;
}
.about-box {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px 24px;
}
.about-box p { margin: 0 0 12px; color: var(--ink-2); line-height: 1.7; font-size: 14.5px; }
.about-box p:last-child { margin: 0; }

/* Episode list */
.episodes {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.episode {
  display: grid; grid-template-columns: 40px 1fr auto auto;
  gap: 14px; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .15s;
}
.episode:last-child { border-bottom: 0; }
.episode:hover { background: var(--bg-sunk); }
.ep-num {
  font-size: 13px; font-weight: 700; color: var(--ink-4);
  font-family: var(--font-num);
  text-align: center;
}
.episode.unlocked .ep-num { color: var(--ok); }
.ep-info { min-width: 0; }
.ep-title {
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  margin: 0 0 2px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ep-meta {
  font-size: 12px; color: var(--ink-3);
  display: flex; gap: 10px; align-items: center;
}
.ep-meta .ep-dot { color: var(--ink-4); }
.ep-price {
  font-size: 14px; font-weight: 700; color: var(--brand);
  font-family: var(--font-num);
}
.ep-price-free { color: var(--ok); font-size: 13px; }
.ep-action .btn { padding: 6px 12px; font-size: 12px; }

/* Purchase side card */
.buy-card {
  position: sticky; top: 88px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--shadow-sm);
}
.buy-price {
  font-size: 28px; font-weight: 700; color: var(--ink);
  font-family: var(--font-num);
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 4px;
}
.buy-price .baht { font-size: 16px; color: var(--ink-3); font-weight: 500; }
.buy-price .per { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.buy-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }
.buy-features { list-style: none; padding: 0; margin: 18px 0 0; border-top: 1px solid var(--line); padding-top: 18px; }
.buy-features li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; color: var(--ink-2);
  padding: 6px 0;
}
.buy-features li::before {
  content: "✓"; color: var(--ok); font-weight: 700;
  flex-shrink: 0;
}

/* ============ Payment page ============ */
.pay-layout {
  max-width: 900px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 360px; gap: 32px;
}
.pay-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 32px;
}
.pay-step-title {
  font-size: 18px; font-weight: 700; margin: 0 0 6px;
}
.pay-step-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 24px; }
.qr-box {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-sunk); border: 2px dashed var(--line-2);
  border-radius: var(--r-lg); padding: 26px;
}
.qr-header {
  background: linear-gradient(135deg, #7C3AED, #FF5E7E);
  color: #fff;
  padding: 12px 18px; border-radius: 12px 12px 0 0;
  font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: -2px;
  width: 260px; justify-content: center;
}
.qr-img {
  width: 260px; height: 260px;
  background: #fff; padding: 18px;
  border-radius: 0 0 10px 10px;
  border: 1px solid var(--line);
}
.qr-amount {
  margin-top: 18px;
  font-size: 13px; color: var(--ink-3);
}
.qr-amount b {
  font-size: 22px; color: var(--ink); font-weight: 700;
  font-family: var(--font-num);
  margin-left: 6px;
}
.pay-summary {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px;
  position: sticky; top: 88px;
}
.pay-summary h4 {
  font-size: 13px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 0 0 14px;
}
.pay-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.pay-item-thumb {
  width: 72px; aspect-ratio: 16/10;
  background: linear-gradient(135deg, #1E40AF, #6366F1);
  border-radius: 6px;
  flex-shrink: 0;
}
.pay-item-info { flex: 1; min-width: 0; }
.pay-item-title { font-size: 13.5px; font-weight: 600; margin: 0 0 2px; }
.pay-item-sub { font-size: 12px; color: var(--ink-3); }
.pay-totals {
  padding-top: 14px;
}
.pay-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 14px;
}
.pay-row.total {
  border-top: 1px solid var(--line);
  margin-top: 8px; padding-top: 14px;
  font-size: 17px; font-weight: 700;
}
.pay-row.total .val { color: var(--brand); font-family: var(--font-num); }

.pay-method-list {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 20px;
}
.pay-method {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: all .15s;
}
.pay-method:hover { border-color: var(--ink-4); }
.pay-method.selected {
  border-color: var(--brand); background: var(--brand-soft);
}
.pay-method-radio {
  width: 18px; height: 18px; border: 1.5px solid var(--line-2);
  border-radius: 50%; position: relative;
}
.pay-method.selected .pay-method-radio { border-color: var(--brand); }
.pay-method.selected .pay-method-radio::after {
  content: ""; position: absolute; inset: 3px;
  background: var(--brand); border-radius: 50%;
}
.pay-method-logo {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, #FF5E7E, #7C3AED);
  color: #fff;
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(255,94,126,.25);
}
.pay-method-name { font-size: 14px; font-weight: 600; }
.pay-method-sub { font-size: 12px; color: var(--ink-3); }

.pay-success {
  text-align: center; padding: 60px 40px;
}
.pay-success-icon {
  width: 76px; height: 76px; margin: 0 auto 20px;
  border-radius: 50%; background: #D1FAE5;
  display: grid; place-items: center;
  color: var(--ok); font-size: 36px; font-weight: 700;
  animation: popIn .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ============ Video player page ============ */
.player-layout {
  display: grid; grid-template-columns: 1fr 340px; gap: 24px;
}
.player-box {
  background: #000; aspect-ratio: 16/9;
  border-radius: var(--r-lg); overflow: hidden;
  position: relative;
}
.player-box iframe {
  width: 100%; height: 100%; border: 0;
}
/* บัง YouTube link/title ป้องกันคลิกหนีออกไปดูเต็มที่ youtube.com */
.yt-block-top {
  position: absolute; top: 0; left: 0; right: 0;
  height: 60px;
  z-index: 5;
  pointer-events: auto;
  background: transparent;
}
.yt-block-corner {
  position: absolute; bottom: 0; right: 50px;
  width: 70px; height: 38px;
  z-index: 5;
  pointer-events: auto;
  background: transparent;
}
.player-locked {
  position: absolute; inset: 0;
  background: #000;
}
.player-locked-preview {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
  opacity: .45;
  pointer-events: none;
  filter: blur(2px);
}
.player-locked-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,.92), rgba(255,94,126,.92));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; padding: 40px;
}
.player-locked-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(8px);
  padding: 6px 14px; border-radius: 100px;
  font-size: 12px; font-weight: 700;
  margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: .05em;
}
.player-locked-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,.2); backdrop-filter: blur(10px);
  display: grid; place-items: center; font-size: 28px;
  margin-bottom: 18px;
}
.player-info {
  padding: 18px 4px 0;
}
.player-ep { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.player-title {
  font-size: 24px; font-weight: 700; letter-spacing: -0.015em;
  margin: 0 0 10px;
}
.player-meta {
  display: flex; gap: 16px; font-size: 13px; color: var(--ink-3);
  margin-bottom: 18px;
}
.player-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.player-desc {
  font-size: 14.5px; color: var(--ink-2); line-height: 1.7;
}

.playlist {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
}
.playlist-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.playlist-head h4 { font-size: 14px; font-weight: 700; margin: 0; }
.playlist-head .count { font-size: 12px; color: var(--ink-3); font-family: var(--font-num); }
.playlist-items { overflow-y: auto; flex: 1; }
.pl-item {
  display: grid; grid-template-columns: 80px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.pl-item:last-child { border-bottom: 0; }
.pl-item:hover { background: var(--bg-sunk); }
.pl-item.active { background: var(--brand-soft); }
.pl-item.active .pl-title { color: var(--brand); }
.pl-thumb {
  width: 80px; aspect-ratio: 16/10;
  background: linear-gradient(135deg, #1E40AF, #6366F1);
  border-radius: 5px; position: relative;
  display: grid; place-items: center;
  color: rgba(255,255,255,.6); font-weight: 700; font-size: 11px;
}
.pl-thumb .pl-lock {
  position: absolute; top: 4px; right: 4px;
  font-size: 10px; background: rgba(0,0,0,.6);
  width: 18px; height: 18px; border-radius: 4px;
  display: grid; place-items: center; color: #fff;
}
.pl-title {
  font-size: 13px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 2px;
}
.pl-duration { font-size: 11px; color: var(--ink-3); font-family: var(--font-num); }
.pl-price {
  font-size: 12px; font-weight: 700; color: var(--brand);
  font-family: var(--font-num);
  white-space: nowrap;
}
.pl-unlocked { color: var(--ok); font-size: 13px; }

/* Files download box */
.file-box {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-top: 8px;
}
.file-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, #7C3AED, #FF5E7E);
  color: #fff;
  display: grid; place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(124,58,237,.25);
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.file-size { font-size: 12px; color: var(--ink-3); }

/* ============ Modal ============ */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(10,15,30,.55); backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  animation: fadeIn .2s;
  padding: 20px;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: var(--r-lg);
  max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
  animation: popUp .25s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
}
@keyframes popUp {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border: 0; background: transparent;
  border-radius: 8px; cursor: pointer; color: var(--ink-3);
  font-size: 18px;
}
.modal-close:hover { background: var(--bg-sunk); color: var(--ink); }
.modal-body { padding: 22px 24px; }
.modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--bg-sunk);
}

/* ============ Login / Register ============ */
.auth-layout {
  min-height: calc(100vh - 64px);
  display: grid; grid-template-columns: 1fr 1fr;
}
.auth-side {
  background:
    radial-gradient(circle at 20% 20%, rgba(253,176,34,.3), transparent 50%),
    linear-gradient(135deg, #FF5E7E 0%, #7C3AED 100%);
  color: #fff;
  padding: 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-side::after {
  content: ""; position: absolute; right: -100px; bottom: -100px;
  width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,166,.35), transparent 65%);
}
.auth-emoji-float {
  position: absolute; font-size: 56px;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.25));
  animation: float 4s ease-in-out infinite;
  z-index: 1;
}
.auth-side h2 {
  font-size: 38px; font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.15; margin: 0 0 16px;
  position: relative;
}
.auth-side p { font-size: 15px; line-height: 1.6; opacity: .85; position: relative; max-width: 380px; }
.auth-stats {
  display: flex; gap: 28px; position: relative;
}
.auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
}
.auth-form {
  width: 100%; max-width: 380px;
}
.auth-form h1 {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.auth-form-sub { font-size: 14px; color: var(--ink-3); margin: 0 0 26px; }

.form-field { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.form-input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--line-2); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: #fff;
  outline: none; transition: all .15s;
}
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-pending {
  display: flex; gap: 12px; align-items: center;
  background: linear-gradient(135deg, #FFF1D6, #FFE4E1);
  border: 1px solid #FECACA;
  padding: 12px 14px; border-radius: 12px;
  margin-bottom: 18px;
}
.auth-pending-icon { font-size: 28px; }
.auth-pending-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.auth-pending-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

.form-input.err { border-color: #E11D48; background: #FFF5F7; }
.form-input.err:focus { box-shadow: 0 0 0 3px rgba(225,29,72,.15); }
.form-err { font-size: 12px; color: #E11D48; margin-top: 5px; font-weight: 500; }
.auth-server-err {
  background: #FFF0F3; border: 1px solid #FECDD3; color: #B91C4F;
  padding: 10px 14px; border-radius: 9px; font-size: 13px;
  margin-bottom: 18px; font-weight: 500;
}
.form-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--ink-4); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.social-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; padding: 11px;
  background: #fff; border: 1.5px solid var(--line-2);
  border-radius: 9px; font-weight: 600; font-size: 14px;
  font-family: inherit; cursor: pointer; transition: all .15s;
  margin-bottom: 8px;
}
.social-btn:hover { background: var(--bg-sunk); }
.auth-alt {
  text-align: center; font-size: 13px; color: var(--ink-3);
  margin-top: 22px;
}
.auth-alt a { color: var(--brand); font-weight: 600; cursor: pointer; }

/* ============ My Courses ============ */
.my-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 28px;
}
.stat-box {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px 20px;
}
.stat-box .lbl {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.stat-box .val {
  font-size: 26px; font-weight: 700;
  font-family: var(--font-num);
}

.empty {
  text-align: center; padding: 70px 20px;
  background: var(--bg-elev); border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--bg-sunk);
  display: grid; place-items: center;
  color: var(--ink-4); font-size: 28px;
}
.empty h3 { margin: 0 0 8px; font-size: 18px; }
.empty p { margin: 0 0 20px; color: var(--ink-3); }

/* ============ Helpers ============ */
.icon-inline {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; flex-shrink: 0;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 100px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-sunk); color: var(--ink-2);
}
.badge-ok { background: #D1FAE5; color: #065F46; }
.badge-brand { background: var(--brand-soft); color: var(--brand); }

.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

/* Card-style variant: flat */
body.card-flat .card,
body.card-flat .card-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none !important;
}
body.card-flat .card:hover,
body.card-flat .card-list:hover {
  transform: none;
  border-color: var(--brand);
}

/* Card-style variant: elevated */
body.card-elevated .card,
body.card-elevated .card-list {
  border: 0;
  box-shadow: var(--shadow-md);
}
body.card-elevated .card:hover,
body.card-elevated .card-list:hover {
  box-shadow: var(--shadow-lg);
}

/* ============ Preview link buttons on cards ============ */
.card-preview-link {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 100px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.card-preview-link:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
.card-preview-full {
  width: 100%; justify-content: center;
  margin-top: 10px;
}
.ep-preview-link {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: 0;
  color: var(--brand); font-weight: 600;
  font-size: 12px; padding: 0; cursor: pointer;
  font-family: inherit;
  text-decoration: underline; text-underline-offset: 3px;
}
.ep-preview-link:hover { color: var(--brand-hover); }

/* ============ Callout: free preview note ============ */
.callout-free {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, var(--brand-soft), #FEF3C7);
  border: 1px solid var(--brand);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
}
.callout-free strong { color: var(--ink); }
.callout-free > span:first-child { font-size: 22px; flex-shrink: 0; }

/* ============ Preview Modal ============ */
.pv-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 10, 35, .75);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 24px;
  z-index: 300;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } }

.pv-modal {
  background: var(--bg-elev);
  border-radius: 20px;
  width: min(960px, 100%);
  max-height: 92vh; overflow: auto;
  box-shadow: 0 30px 80px rgba(20, 10, 35, .5);
  position: relative;
  animation: pvIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pvIn {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
}
.pv-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  border: 0; cursor: pointer; z-index: 5;
  font-size: 22px; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s;
}
.pv-close:hover { background: rgba(0,0,0,.85); }

.pv-video {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
}
.pv-video iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
}
.pv-badge {
  position: absolute; top: 14px; left: 14px;
  background: rgba(239, 68, 68, .95);
  color: #fff;
  padding: 7px 13px; border-radius: 100px;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, .4);
  z-index: 3;
}
.pv-ended {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; text-align: center;
  background: linear-gradient(135deg, rgba(124, 58, 237, .95), rgba(255, 94, 126, .95));
  color: #fff; padding: 24px;
}
.pv-ended-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: grid; place-items: center;
}
.pv-ended h3 { margin: 0; font-size: 24px; }
.pv-ended p { margin: 0; opacity: .9; font-size: 15px; max-width: 400px; }

.pv-info { padding: 26px 30px 30px; }
.pv-meta {
  color: var(--ink-3); font-size: 13px;
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600;
}
.pv-title {
  margin: 6px 0 10px;
  font-size: 26px; font-weight: 800; color: var(--ink);
  line-height: 1.25;
}
.pv-desc { margin: 0; color: var(--ink-2); line-height: 1.6; }
.pv-divider {
  height: 1px; background: var(--line);
  margin: 20px 0;
}
.pv-actions {
  display: flex; align-items: center; gap: 14px;
}
.pv-price-box {
  flex-shrink: 0;
  padding: 6px 18px;
  border-right: 1px solid var(--line);
}
.pv-price-lbl {
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .08em;
  font-weight: 600;
}
.pv-price {
  font-size: 32px; font-weight: 800; color: var(--brand);
  line-height: 1.1;
}
.pv-price .baht {
  font-size: 20px; margin-right: 2px;
  vertical-align: 2px;
}
.pv-actions .btn-lg { flex: 1; }

.pv-benefits {
  display: flex; flex-wrap: wrap; gap: 14px 20px;
  margin-top: 16px;
  font-size: 13px; color: var(--ink-3);
}
.pv-benefits span {
  display: inline-flex; align-items: center; gap: 6px;
}
.pv-benefits svg { color: var(--accent-3); }

@media (max-width: 640px) {
  .pv-info { padding: 20px; }
  .pv-title { font-size: 20px; }
  .pv-actions { flex-direction: column; align-items: stretch; }
  .pv-price-box { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; text-align: center; }
}


/* ============ Admin Gate & Panel ============ */
.admin-gate {
  background: var(--bg-elev);
  border-radius: var(--r-xl);
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 2px solid var(--line-2);
}
.admin-gate-icon {
  font-size: 44px;
  margin-bottom: 8px;
}
.admin-gate h3 { margin: 0 0 6px; font-size: 22px; }
.admin-gate p { margin: 0 0 20px; color: var(--ink-3); font-size: 14px; }
.admin-gate form { display: flex; flex-direction: column; gap: 12px; }
.admin-gate .input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-md);
  font-size: 15px;
  font-family: var(--font-sans);
  background: var(--bg);
}
.admin-gate .input:focus { outline: none; border-color: var(--brand); }
.admin-err {
  background: #FEE4E4;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
}
.admin-gate-actions { display: flex; gap: 8px; }
.admin-gate-actions .btn { flex: 1; }
.admin-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  padding: 8px;
  background: var(--bg-sunk);
  border-radius: var(--r-sm);
}
.admin-hint code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-num);
  color: var(--brand);
  font-weight: 600;
}

/* Overlay + panel */
.adm-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 11, 46, 0.55);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
  animation: admFade .2s ease-out;
}
@keyframes admFade { from { opacity: 0; } to { opacity: 1; } }
.adm-panel {
  background: var(--bg);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 1200px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.adm-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #FFE8F0 0%, #F3E5FF 100%);
  border-bottom: 2px solid var(--line-2);
}
.adm-head > div:first-child { flex: 1; }
.adm-head h2 { margin: 6px 0 4px; font-size: 24px; }
.adm-head p { margin: 0; color: var(--ink-3); font-size: 13px; }
.adm-head-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: var(--ink);
  color: var(--brand);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.adm-close {
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  font-size: 22px;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.adm-close:hover { background: rgba(0,0,0,0.16); }

.adm-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.adm-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 16px 0 0;
  border-right: 1px solid var(--line);
}
.adm-stat:last-of-type { border-right: none; }
.adm-stat-num {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--brand);
  line-height: 1;
}
.adm-stat-lbl {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}
.adm-price-box {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  background: var(--bg-sunk);
  border-radius: var(--r-md);
}
.adm-price-box label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.adm-price-input {
  display: flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 0 4px 0 10px;
}
.adm-price-input span { color: var(--ink-3); font-weight: 600; }
.adm-price-input input {
  width: 70px;
  border: none;
  background: transparent;
  padding: 6px;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}
.adm-price-input input:focus { outline: none; }

.adm-tabs {
  display: flex; gap: 4px;
  padding: 0 28px; background: #fff;
  border-bottom: 1px solid var(--line);
}
.adm-tab {
  padding: 12px 18px; background: transparent; border: 0;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink-3);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.adm-tab:hover { color: var(--ink); }
.adm-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.adm-members {
  padding: 20px 28px; overflow: auto; flex: 1;
  background: var(--bg-sunk);
}
.adm-members-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.adm-members-stats { font-size: 14px; color: var(--ink-2); }
.adm-members-stats b { font-size: 18px; color: var(--ink); margin-right: 4px; }
.adm-members-list {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}
.adm-members-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.3fr;
  gap: 14px; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.adm-members-row:last-child { border-bottom: 0; }
.adm-members-row.head {
  background: var(--bg-sunk); font-weight: 600; font-size: 12px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em;
}
.adm-members-row > div { display: flex; align-items: center; gap: 10px; }
.adm-mem-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #FDB022, #FF5E7E);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.adm-mem-info { display: flex; flex-direction: column; gap: 2px; }
.adm-mem-name { font-weight: 600; color: var(--ink); }
.adm-mem-email { font-size: 12px; color: var(--ink-3); }
.adm-mem-date { color: var(--ink-3); }
.adm-mem-actions { justify-content: flex-end; }

.adm-body {
  display: grid;
  grid-template-columns: 380px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.adm-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg-elev);
}
.adm-list-head {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.adm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s;
}
.adm-row:hover { background: var(--bg-sunk); }
.adm-row.active {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}
.adm-row.warn:not(.active) {
  background: #FFF6E5;
}
.adm-row-n {
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  width: 22px;
  text-align: center;
}
.adm-row-emoji { font-size: 20px; }
.adm-row-info { flex: 1; min-width: 0; }
.adm-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-row-sub {
  display: flex;
  gap: 4px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.adm-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-sunk);
  color: var(--ink-3);
  font-family: var(--font-num);
}
.adm-chip.ok { background: #D1FAE5; color: #065F46; }
.adm-chip.warn { background: #FEF3C7; color: #92400E; }
.adm-row-actions {
  display: flex;
  gap: 2px;
  opacity: 0.4;
  transition: opacity .12s;
}
.adm-row:hover .adm-row-actions,
.adm-row.active .adm-row-actions { opacity: 1; }
.adm-iconbtn {
  width: 26px; height: 26px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.adm-iconbtn:hover { background: rgba(0,0,0,0.08); }
.adm-iconbtn.danger:hover { background: #FEE; color: var(--danger); }

.adm-editor {
  overflow-y: auto;
  padding: 24px 32px;
  background: var(--bg);
}
.adm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--ink-3);
}
.adm-empty h3 { color: var(--ink); margin: 0 0 4px; }

.adm-form { max-width: 680px; }
.adm-form-head { margin-bottom: 20px; }
.adm-form-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.adm-form-head h3 { margin: 0; font-size: 22px; }

.adm-field { margin-bottom: 18px; }
.adm-lbl {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.adm-sublbl {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-3);
}
.adm-field .input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg-elev);
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.adm-field .input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.adm-field textarea.input {
  resize: vertical;
  min-height: 50px;
  line-height: 1.5;
}
.adm-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.adm-preview {
  margin-top: 10px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
  border: 1.5px solid var(--line-2);
}
.adm-preview iframe {
  width: 100%; height: 100%; border: none;
}
.adm-note {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-3);
  background: var(--bg-sunk);
  border-radius: var(--r-sm);
  line-height: 1.5;
}
.adm-note.warn {
  background: #FEF3C7;
  color: #92400E;
  font-weight: 500;
}
.adm-section-head {
  margin: 24px 0 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.adm-save-hint {
  margin-top: 20px;
  padding: 10px 14px;
  background: #D1FAE5;
  color: #065F46;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

/* Edit pen button on admin */
.edit-pen {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 48px; height: 48px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 8000;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.15;
  transition: opacity .2s, transform .2s;
}
.edit-pen:hover { opacity: 1; transform: scale(1.08); }

@media (max-width: 860px) {
  .adm-body { grid-template-columns: 1fr; }
  .adm-list { max-height: 240px; }
  .adm-overlay { padding: 0; }
  .adm-panel { border-radius: 0; }
  .adm-head { padding: 16px 20px; }
  .adm-head h2 { font-size: 20px; }
  .adm-editor { padding: 20px; }
  .adm-row-2 { grid-template-columns: 1fr; }
  .adm-toolbar { padding: 12px 20px; gap: 8px; }
  .adm-stat { padding: 0 10px 0 0; }
}

/* ──────────── Admin Payments tab ──────────── */
.adm-payments {
  padding: 0;
}
.adm-pay-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunk);
}
.adm-pay-stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.apl-num {
  font-family: var(--font-num);
  font-size: 22px; font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.apl-num.green { color: #059669; }
.apl-num.orange { color: #D97706; }
.apl-num.red { color: #DC2626; }
.apl-lbl {
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .5px;
}
.adm-pay-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.adm-pay-filters { display: flex; gap: 6px; }
.adm-fchip {
  padding: 6px 12px; font-size: 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer;
  color: var(--ink-2);
  font-weight: 500;
}
.adm-fchip.active {
  background: var(--brand); color: #fff;
  border-color: var(--brand);
}

.adm-pay-list {
  display: flex; flex-direction: column;
  padding: 4px 24px 24px;
}
.adm-pay-row {
  display: grid;
  grid-template-columns: 130px 200px 1fr 80px 110px 50px;
  gap: 14px; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s;
}
.adm-pay-row:hover:not(.head) { background: var(--bg-sunk); }
.adm-pay-row.head {
  font-size: 11px; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  letter-spacing: .5px;
  cursor: default;
  background: transparent;
}
.adm-pay-time {
  font-family: var(--font-num); font-size: 12px;
  color: var(--ink-2);
}
.adm-pay-amt {
  font-family: var(--font-num); font-weight: 700;
  font-size: 15px;
}
.adm-pay-status {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.adm-pay-status.approved { background: #D1FAE5; color: #047857; }
.adm-pay-status.pending  { background: #FEF3C7; color: #92400E; }
.adm-pay-status.rejected { background: #FEE2E2; color: #991B1B; }
.adm-pay-status.error    { background: #F3F4F6; color: #6B7280; }

/* Detail modal */
.adm-pdetail-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .15s;
}
.adm-pdetail {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%; max-width: 920px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 48px rgba(0,0,0,.25);
  overflow: hidden;
}
.adm-pdetail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.adm-pdetail-title { font-size: 18px; font-weight: 700; }
.adm-pdetail-sub {
  font-size: 12px; color: var(--ink-3); margin-top: 4px;
}
.adm-pdetail-sub code {
  background: var(--bg-sunk); padding: 2px 6px;
  border-radius: 4px; font-family: var(--font-num);
}
.adm-pdetail-body {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 24px;
  padding: 24px;
  overflow-y: auto;
}
.adm-pdetail-image {
  background: var(--bg-sunk);
  border-radius: 12px;
  padding: 12px;
  display: flex; align-items: flex-start; justify-content: center;
  min-height: 280px;
}
.adm-pdetail-image img {
  max-width: 100%; max-height: 480px;
  border-radius: 8px;
  display: block;
}
.adm-pdetail-noslip {
  color: var(--ink-3); padding: 60px 20px;
}
.adm-pdetail-info {
  display: flex; flex-direction: column; gap: 18px;
}
.adm-pd-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.adm-pd-section:last-child { border-bottom: 0; padding-bottom: 0; }
.adm-pd-lbl {
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px; font-weight: 600;
}
.adm-pd-ai {
  background: var(--bg-sunk);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.adm-pd-ai-row {
  display: flex; justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.adm-pd-ai-row:last-child { border-bottom: 0; }
.adm-pd-ai-row span { color: var(--ink-3); }
.adm-pd-ai-row code {
  font-family: var(--font-num); font-size: 12px;
  background: var(--bg-card); padding: 2px 6px;
  border-radius: 4px;
}
.adm-pd-rawtext {
  margin-top: 8px;
  padding: 10px 12px;
  background: #F1F5F9;
  border-radius: 6px;
  font-size: 12px; line-height: 1.5;
  color: var(--ink-2);
  font-style: italic;
}
.adm-pdetail-actions {
  display: flex; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-sunk);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 880px) {
  .adm-pay-stats { grid-template-columns: repeat(3, 1fr); }
  .adm-pay-row { grid-template-columns: 90px 1fr 80px 90px; gap: 10px; font-size: 12px; }
  .adm-pay-row > div:nth-child(3) { display: none; }
  .adm-pdetail-body { grid-template-columns: 1fr; }
}

/* ──────────── Pay flow v2 (slip upload + verify) ──────────── */
.pay-steps {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--bg-card); border-radius: var(--rad);
  border: 1px solid var(--line);
}
.pay-step {
  display: flex; align-items: center; gap: 10px;
  opacity: .5;
}
.pay-step.active, .pay-step.done { opacity: 1; }
.pay-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-sunk); color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  font-family: var(--font-num);
}
.pay-step.active .pay-step-num { background: var(--brand); color: #fff; }
.pay-step.done .pay-step-num { background: #10B981; color: #fff; }
.pay-step.done .pay-step-num::after { content: "✓"; }
.pay-step.done .pay-step-num { font-size: 0; }
.pay-step.done .pay-step-num::after { font-size: 14px; }
.pay-step-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.pay-step.active .pay-step-label { color: var(--ink); }
.pay-step-line {
  flex: 1; height: 2px; background: var(--line);
  border-radius: 2px;
}

.qr-img-real {
  width: 280px; height: auto; border-radius: 12px;
  display: block; margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
}
.qr-receiver {
  margin-top: 14px; padding: 12px 14px;
  background: var(--bg-sunk); border-radius: 10px;
  font-size: 13px; line-height: 1.7;
  text-align: left;
}
.qr-receiver b { color: var(--ink-2); }

.pay-tip {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 18px; padding: 12px 14px;
  background: linear-gradient(135deg, #FFF7E6, #FFEEDD);
  border: 1px solid #FFE4C4;
  border-radius: 10px;
  font-size: 13px; color: var(--ink-2); line-height: 1.55;
}
.pay-tip-ico { font-size: 18px; flex-shrink: 0; }

/* Slip drop zone */
.slip-drop {
  position: relative;
  margin-top: 16px;
  border: 2px dashed var(--line-2);
  border-radius: 14px;
  background: var(--bg-sunk);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.slip-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.slip-drop.hover { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.01); }
.slip-drop.filled { padding: 12px; cursor: default; }
.slip-drop-icon { font-size: 56px; margin-bottom: 10px; opacity: .7; }
.slip-drop-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.slip-drop-sub { font-size: 12px; color: var(--ink-3); }
.slip-preview {
  max-width: 100%; max-height: 360px; border-radius: 10px;
  display: block; margin: 0 auto;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
}
.slip-preview-overlay {
  position: absolute; top: 16px; right: 16px;
}

/* Verifying */
.pay-verifying {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px;
}
.verify-spinner {
  width: 64px; height: 64px;
  border: 4px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: vspin .9s linear infinite;
}
@keyframes vspin { to { transform: rotate(360deg); } }
.verify-checks {
  margin-top: 28px; display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 320px;
}
.verify-check {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-3);
  animation: vcheck-fade 1.6s ease-out infinite;
}
.verify-check:nth-child(1) { animation-delay: 0s; }
.verify-check:nth-child(2) { animation-delay: .35s; }
.verify-check:nth-child(3) { animation-delay: .7s; }
.verify-check:nth-child(4) { animation-delay: 1.05s; }
.vc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  animation: vcdot 1.6s ease-out infinite;
}
@keyframes vcheck-fade {
  0%, 50%, 100% { opacity: .55; }
  25% { opacity: 1; }
}
@keyframes vcdot {
  0%, 50%, 100% { transform: scale(1); background: var(--ink-4); }
  25% { transform: scale(1.3); background: var(--brand); box-shadow: 0 0 8px var(--brand); }
}

/* Pay Result */
.pay-result {
  text-align: center;
  padding: 32px 20px;
}
.pr-icon-big {
  width: 88px; height: 88px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 700;
  color: #fff;
}
.pr-icon-big.approved {
  background: linear-gradient(135deg, #10B981, #059669);
  box-shadow: 0 8px 24px rgba(16,185,129,.35);
  animation: pr-pop .5s cubic-bezier(.34,1.56,.64,1);
}
.pr-icon-big.pending {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  box-shadow: 0 8px 24px rgba(245,158,11,.35);
}
.pr-icon-big.rejected {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 8px 24px rgba(239,68,68,.35);
}
@keyframes pr-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.pr-title {
  font-size: 24px; font-weight: 700;
  margin: 0 0 8px;
}
.pr-msg {
  color: var(--ink-3); margin: 0 auto 22px;
  max-width: 420px; line-height: 1.6;
}
.pr-checks {
  display: flex; flex-direction: column; gap: 8px;
  text-align: left;
  background: var(--bg-sunk);
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.pr-check {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.pr-check.ok { color: #059669; }
.pr-check.fail { color: #DC2626; }
.pr-check.warn { color: #D97706; }
.pr-check-ico {
  font-size: 14px; font-weight: 700;
  width: 18px; text-align: center;
}
.pr-ref {
  display: inline-flex; gap: 8px; align-items: center;
  background: var(--bg-sunk); padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
}
.pr-ref-lbl { color: var(--ink-3); }
.pr-ref-val {
  font-family: var(--font-num);
  color: var(--ink); font-weight: 600;
}
.pr-info {
  background: #FEF3C7; border: 1px solid #FDE68A;
  padding: 12px 14px; border-radius: 10px;
  font-size: 12px; line-height: 1.6;
  text-align: left;
  color: #92400E;
}
.pr-info.danger {
  background: #FEE2E2; border-color: #FECACA;
  color: #991B1B;
}
.pr-info code {
  background: rgba(0,0,0,.06); padding: 2px 6px;
  border-radius: 4px; font-family: var(--font-num);
}

/* Mobile pay steps */
@media (max-width: 640px) {
  .pay-steps { padding: 12px; gap: 4px; }
  .pay-step-label { display: none; }
  .pay-step.active .pay-step-label { display: block; font-size: 11px; }
  .qr-img-real { width: 240px; }
  .pr-title { font-size: 20px; }
  .pr-icon-big { width: 72px; height: 72px; font-size: 36px; }
}

