:root {
  --bg: #f6f7f9;
  --text: #17202a;
  --muted: #64748b;
  --line: #d9dee7;
  --panel: #ffffff;
  --primary: #1473e6;
  --primary-dark: #0f5ebd;
  --success: #108a42;
  --warning: #b7791f;
  --danger: #c2410c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.nav a {
  text-decoration: none;
}

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

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 32px auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 28px;
  align-items: stretch;
  padding: 26px 0 18px;
}

.course-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 28px;
  align-items: center;
  padding: 34px 0;
}

.course-hero h1 {
  margin: 8px 0 14px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.05;
}

.eyebrow {
  color: var(--success);
  font-size: 14px;
  font-weight: 800;
}

.course-media {
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 32, 42, 0.82), rgba(20, 115, 230, 0.55)),
    url("assets/hero.svg") center/cover no-repeat;
}

.course-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.buy-button {
  min-width: 160px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.hero-media {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(20, 115, 230, 0.13), rgba(16, 138, 66, 0.12)),
    url("assets/hero.svg") center/cover no-repeat;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  padding: 20px;
}

.product h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.desc {
  min-height: 54px;
  color: var(--muted);
  line-height: 1.6;
}

.price {
  margin: 18px 0;
  font-size: 36px;
  font-weight: 800;
}

.price.compact {
  margin: 8px 0;
  font-size: 30px;
}

.price small {
  font-size: 16px;
  color: var(--muted);
}

.product ul,
.delivery-list {
  margin: 0 0 18px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.product .button {
  margin-top: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: #fff;
  color: var(--primary);
}

.button.secondary:hover {
  background: #edf5ff;
}

.button:disabled {
  border-color: #aab5c4;
  background: #aab5c4;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.38);
}

.modal.open {
  display: flex;
}

.modal-box {
  width: min(460px, 100%);
  padding: 22px;
}

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

.modal-head h2 {
  margin: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.pay-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.panel {
  padding: 20px;
}

.kv {
  display: grid;
  gap: 12px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.kv-row span:first-child {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.status.paid,
.status.delivered {
  background: #e8f6ee;
  color: var(--success);
}

.status.pending {
  background: #fff7e6;
  color: var(--warning);
}

.status.failed {
  background: #fff1ed;
  color: var(--danger);
}

.delivery-box {
  display: none;
}

.delivery-box.visible {
  display: block;
}

.qr {
  width: 160px;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-products {
  margin-bottom: 20px;
}

.config-panel {
  margin-bottom: 22px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafb;
}

.config-item span {
  color: var(--muted);
  font-size: 14px;
}

.link-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.link-card h2 {
  margin: 0;
  font-size: 18px;
}

.pay-qr {
  width: 160px;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.direct-link {
  overflow-wrap: anywhere;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafb;
}

.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
  background: #fff;
  border: 1px solid var(--line);
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f9fafb;
  color: var(--muted);
  font-weight: 700;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 16px;
  }

  .hero,
  .course-hero,
  .course-content,
  .products,
  .link-grid,
  .config-grid,
  .pay-layout {
    grid-template-columns: 1fr;
  }

  .hero-media {
    min-height: 180px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }
}
