:root {
  --brand: #3178f6;
  --brand-dark: #2060d8;
  --brand-soft: #edf4ff;
  --wx-green: #07c160;
  --wx-green-dark: #06ad56;
  --orange: #f97316;
  --price: #ef5b25;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #e9edf3;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.app-shell {
  max-width: 460px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 28px rgba(15, 23, 42, 0.08);
}

/* Top Navigation Bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 50px;
  background: linear-gradient(90deg, #2d74f6 0%, #4085fa 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
}

.top-bar-left, .top-bar-right {
  min-width: 68px;
  display: flex;
  align-items: center;
}

.top-bar-right {
  justify-content: flex-end;
}

.top-bar-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  flex: 1;
  padding: 0 8px;
}

.top-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 4px;
}

.top-btn.pill {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}

.main-view {
  flex: 1;
  padding-bottom: 76px;
  overflow-x: hidden;
}

/* Bottom Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  height: 58px;
  background: #ffffff;
  border-top: 1px solid #e7eaf0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-bar.hidden {
  display: none;
}

.tab-item {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #7c8594;
  font-size: 11px;
  cursor: pointer;
  position: relative;
}

.tab-item.active {
  color: var(--brand);
  font-weight: 600;
}

.tab-icon {
  font-size: 20px;
  line-height: 1.1;
}

.tab-badge {
  position: absolute;
  top: 4px;
  right: 24%;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 99px;
  padding: 0 4px;
  text-align: center;
}

/* Home Dashboard (Screenshot 2 style) */
.home-panel {
  background: #fff;
  padding: 14px 12px 18px;
  margin-bottom: 10px;
}

.quick-cards-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.q-card {
  background: #fafbfd;
  border: 1px solid #eef1f6;
  border-radius: 10px;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s, background 0.12s;
}

.q-card:active {
  transform: scale(0.97);
  background: #f0f5ff;
}

.q-card-icon {
  font-size: 22px;
  color: #374151;
}

.q-card-label {
  font-size: 12px;
  color: #374151;
  font-weight: 500;
}

.q-card-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  padding: 0 5px;
  border-radius: 99px;
  line-height: 16px;
}

.circle-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.circle-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: #fff;
  padding: 14px 10px 12px;
  border-bottom: 1px solid #eef0f4;
}

.circle-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 0;
}

.circle-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.c-teal { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }
.c-amber { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.c-purple { background: linear-gradient(135deg, #c084fc, #a855f7); }
.c-rose { background: linear-gradient(135deg, #fb7185, #e11d48); }
.c-pink { background: linear-gradient(135deg, #f472b6, #ec4899); }
.c-blue { background: linear-gradient(135deg, #60a5fa, #2563eb); }

.circle-label {
  font-size: 12px;
  color: #374151;
}

/* Promo Banner */
.promo-banner {
  margin: 0 12px 12px;
  border-radius: 12px;
  background: linear-gradient(125deg, #1b5ee0 0%, #2a85f7 55%, #16a3f0 100%);
  color: #fff;
  padding: 18px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(49, 120, 246, 0.24);
  cursor: pointer;
}

.promo-banner::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.promo-tag {
  display: inline-block;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 99px;
  margin-bottom: 6px;
}

.promo-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0 0 4px;
}

.promo-sub {
  font-size: 12px;
  opacity: 0.92;
  margin: 0;
}

/* Pending Order Alert Strip */
.pending-strip {
  margin: 0 12px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pending-strip-text {
  font-size: 12px;
  color: #92400e;
}

.pending-strip-btn {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Section Title */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px 8px;
}

.sec-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.sec-more {
  font-size: 12px;
  color: var(--brand);
  background: none;
  border: none;
  cursor: pointer;
}

/* Filter Panel (Screenshot 3 style) */
.filter-box {
  background: #fff;
  padding: 10px 12px 12px;
  margin-bottom: 10px;
}

.search-wrap {
  position: relative;
  margin-bottom: 8px;
}

.search-input {
  width: 100%;
  height: 38px;
  background: #f5f6f8;
  border: 1px solid #eceef2;
  border-radius: 8px;
  padding: 0 36px 0 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.search-input:focus {
  border-color: var(--brand);
  background: #fff;
}

.search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 16px;
}

.filter-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.filter-select {
  height: 36px;
  background: #f5f6f8;
  border: 1px solid #eceef2;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  outline: none;
}

.only-avail-btn {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--brand);
  background: #f2f7ff;
  color: var(--brand);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.only-avail-btn.active {
  background: var(--brand);
  color: #fff;
}

/* Course Card (Screenshot 3 style) */
.course-list {
  padding: 0 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 1px solid #eef0f5;
  transition: transform 0.12s;
}

.course-card:active {
  transform: scale(0.99);
}

.course-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.course-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
}

.status-pill {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.st-open { background: linear-gradient(90deg, #3178f6, #4b8ff8); }
.st-full { background: #f59e0b; }
.st-closed { background: #94a3b8; }
.st-enrolled { background: #10b981; }

.course-meta-strip {
  background: #f7f8fa;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 10px;
}

.course-price {
  color: var(--price);
  font-weight: 700;
  font-size: 15px;
}

.course-price.free {
  color: #10b981;
}

.course-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4b5563;
  margin-top: 5px;
}

.course-line.campus {
  color: #d97706;
}

.seat-chip {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.seat-chip.low {
  background: #fef2f2;
  color: #dc2626;
}

/* Course Detail Page (Screenshot 4 style) */
.detail-section {
  background: #fff;
  margin: 10px 12px;
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: var(--shadow);
}

.detail-sec-header {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.detail-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  display: inline-block;
}

.info-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.info-cell {
  background: #f7f8fa;
  border-radius: 8px;
  padding: 10px 10px;
}

.info-cell.full {
  grid-column: 1 / -1;
}

.info-label {
  font-size: 12px;
  color: #374151;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.info-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}

.info-value {
  font-size: 13px;
  color: #4b5563;
  word-break: break-word;
}

.info-value.highlight {
  color: var(--price);
  font-weight: 700;
  font-size: 15px;
}

.fee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  background: #f7f8fa;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

/* Sticky Enroll Action Bar */
.detail-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 60;
}

.footer-price-box {
  display: flex;
  flex-direction: column;
}

.footer-price {
  color: var(--price);
  font-size: 18px;
  font-weight: 700;
}

.footer-seats {
  font-size: 11px;
  color: var(--muted);
}

.btn-primary {
  background: linear-gradient(90deg, #2d74f6, #4287fa);
  color: #fff;
  border: none;
  border-radius: 999px;
  height: 42px;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.btn-wx {
  background: var(--wx-green);
  color: #fff;
  border: none;
  border-radius: 10px;
  height: 44px;
  width: 100%;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-wx:active { background: var(--wx-green-dark); }

.btn-outline {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  cursor: pointer;
}

.btn-danger-outline {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 10px;
  height: 40px;
  padding: 0 16px;
  font-size: 13px;
  cursor: pointer;
}

/* Generic Card & Lists */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin: 10px 12px;
  box-shadow: var(--shadow);
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
}

.b-blue { background: #eff6ff; color: #2563eb; }
.b-green { background: #ecfdf5; color: #059669; }
.b-amber { background: #fffbeb; color: #d97706; }
.b-red { background: #fef2f2; color: #dc2626; }
.b-gray { background: #f3f4f6; color: #6b7280; }

/* Form Inputs */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.form-control:focus {
  border-color: var(--brand);
}

/* Electronic Student Card */
.id-card {
  margin: 14px 12px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 55%, #0ea5e9 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.id-card-top {
  padding: 18px 18px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.id-card-body {
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.id-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

.id-qr-wrap {
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #374151;
}

/* Award Certificate Canvas */
.award-canvas {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  display: block;
}

/* Modal / Bottom Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 18px 16px 24px;
  animation: slideUp 0.18s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  border: none;
  background: #f3f4f6;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

/* Profile Header */
.me-header {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  padding: 18px 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.me-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.menu-list {
  background: #fff;
  margin: 10px 12px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.menu-row {
  width: 100%;
  background: #fff;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
}

.menu-row:last-child { border-bottom: none; }
.menu-row:active { background: #f8fafc; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.alert-warn {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Toast */
.toast-root {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.toast {
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  text-align: center;
}
