:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-soft: #f8f8fa;
  --text: #2f3440;
  --muted: #6a7282;
  --line: #d8dde6;
  --line-strong: #b9bfcc;
  --brand: #ce9bbc;
  --brand-dark: #1f232c;
  --btn-bg: #222631;
  --btn-text: #ffffff;
  --success-bg: #ecf9f1;
  --success-line: #95cca9;
  --success-text: #195f33;
  --error-bg: #fff2f2;
  --error-line: #e3a9a9;
  --error-text: #8f2323;
  --info-bg: #edf5fe;
  --info-line: #9ec2e7;
  --info-text: #1e4b71;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
}

main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 22px 16px 36px;
}

.hidden {
  display: none !important;
}

.small {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--btn-bg);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--btn-text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 14px;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn.ghost {
  background: transparent;
  color: var(--btn-bg);
  border-color: var(--line-strong);
}

.btn.full {
  width: 100%;
}

.topbar {
  background: #1f232c;
  color: #f4f6fb;
  font-weight: 600;
  padding: 12px 16px;
}

.brandbar {
  min-height: 74px;
  background: var(--brand);
  border-bottom: 1px solid #c691b3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
}

.brand-logo {
  width: auto;
  max-height: 50px;
}

.hero {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(150deg, #ffffff, #f8edf6);
  padding: 26px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.1;
}

.hero p {
  margin: 0;
  max-width: 760px;
}

.row {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #eef0f5;
}

.card-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.card h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.card p {
  margin: 0;
  color: #444b58;
}

.meta {
  font-size: 14px;
  color: var(--muted);
}

.auth-wrap {
  max-width: 570px;
  margin: 30px auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 22px;
}

.auth-wrap h1 {
  margin: 0;
  font-size: 30px;
}

.auth-tabs {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.auth-tab {
  border: 1px solid #bec5d2;
  border-radius: 8px;
  background: #ffffff;
  color: #242933;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  padding: 9px 8px;
  cursor: pointer;
}

.auth-tab.is-active {
  border-color: #222631;
  background: #222631;
  color: #ffffff;
}

.auth-form {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.auth-form label {
  font-weight: 600;
  font-size: 14px;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c3c9d6;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 11px;
  font-size: 16px;
}

.auth-form input:focus {
  outline: 2px solid #f3dff0;
  border-color: #b785a9;
}

.auth-actions {
  display: flex;
  gap: 8px;
}

.auth-status {
  margin-top: 14px;
  border-radius: 8px;
  border: 1px solid #ced4e0;
  background: #f4f7fc;
  color: #2d3a4f;
  padding: 10px 12px;
  font-size: 14px;
}

.auth-status.success {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success-text);
}

.auth-status.error {
  border-color: var(--error-line);
  background: var(--error-bg);
  color: var(--error-text);
}

.auth-status.info {
  border-color: var(--info-line);
  background: var(--info-bg);
  color: var(--info-text);
}

.auth-session {
  margin-top: 16px;
  border-top: 1px solid #e2e6ee;
  padding-top: 12px;
}

.portal-body {
  background: #f3f4f6;
  color: #2d3340;
}

.return-admin-bar {
  background: #1b1f26;
  color: #eceff8;
  border-bottom: 1px solid #262b34;
}

.return-admin-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.return-admin-link {
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.return-admin-link:hover {
  text-decoration: underline;
}

.return-admin-note {
  margin: 0;
  color: #d1d8e5;
  font-size: 13px;
}

.school-header {
  background: var(--brand);
  border-bottom: 1px solid #c690b2;
}

.school-header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 10px 16px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.school-header-logo {
  width: auto;
  max-height: 46px;
}

.school-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.school-nav a {
  text-decoration: none;
  color: #2d3340;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.school-nav a:hover {
  background: rgba(255, 255, 255, 0.35);
}

.account-menu {
  position: relative;
  margin-left: 4px;
}

.account-toggle {
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(26, 30, 37, 0.25);
  background: rgba(255, 255, 255, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.account-avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #d7dce6;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 270px;
  border: 1px solid #d7dde8;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 30px rgba(17, 23, 33, 0.18);
  overflow: hidden;
  z-index: 100;
}

.account-item {
  display: block;
  width: 100%;
  border: 0;
  background: #ffffff;
  color: #2d3340;
  font-size: 16px;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  min-height: 44px;
  padding: 11px 14px;
}

.account-item:hover {
  background: #f4f6fb;
}

.account-divider {
  border-top: 1px solid #e4e8ef;
}

.product-shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 16px 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 20px;
  align-items: start;
}

.product-main {
  min-width: 0;
}

.product-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}

.product-heading {
  margin: 0;
  font-size: clamp(42px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.product-description {
  margin: 14px 0 0;
  font-size: 17px;
  color: #3f4656;
}

.product-description.clamped {
  max-height: 162px;
  overflow: hidden;
}

.read-more-btn {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: #4a546a;
  text-decoration: underline;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  padding: 0;
  cursor: pointer;
}

.curriculum-wrap {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

.curriculum-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.curriculum-title {
  margin: 0;
  font-size: clamp(34px, 4.2vw, 46px);
  line-height: 1.1;
}

.curriculum-sub {
  margin: 6px 0 0;
  color: #626c7f;
  font-size: 15px;
}

.expand-btn {
  border: 0;
  background: transparent;
  color: #4a546a;
  text-decoration: underline;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  padding: 0;
  cursor: pointer;
}

.curriculum-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.section-item {
  border-radius: 8px;
  overflow: hidden;
}

.section-toggle {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: #222733;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 11px;
  cursor: pointer;
}

.section-toggle:hover {
  border-color: #80889a;
}

.section-lesson-count {
  color: #656e80;
  font-size: 13px;
  font-weight: 500;
}

.section-chevron {
  transition: transform 0.2s ease;
}

.section-item.open .section-chevron {
  transform: rotate(180deg);
}

.section-lessons {
  display: none;
  border-left: 1px solid #e6e9ef;
  border-right: 1px solid #e6e9ef;
  border-bottom: 1px solid #e6e9ef;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.section-item.open .section-lessons {
  display: block;
}

.lesson-row {
  display: block;
  text-decoration: none;
  color: #2f3542;
  font-size: 15px;
  padding: 10px 11px;
  min-height: 44px;
  border-top: 1px solid #eceff4;
  background: #f5f6f9;
}

.lesson-row:nth-child(even) {
  background: #eff2f6;
}

.lesson-row.quiz {
  background: #ffffff;
}

.lesson-row:hover {
  background: #e8ebf2;
}

.price-card {
  position: sticky;
  top: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.price-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #f0f2f6;
}

.price-card-body {
  padding: 12px;
}

.price-chip {
  border: 1px solid #9fa7b7;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  color: #2f3542;
  padding: 10px 11px;
  margin-bottom: 10px;
}

.price-subtext {
  color: #667080;
  font-size: 14px;
}

.buy-btn {
  width: 100%;
  min-height: 44px;
  border: 1px solid #9fa6b4;
  border-radius: 8px;
  background: #9b9ea6;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.buy-btn:hover {
  filter: brightness(1.02);
}

.school-footer {
  background: var(--brand);
  color: #ffffff;
  text-align: center;
  padding: 26px 16px;
  font-size: 14px;
  margin-top: 22px;
}

.checkout-shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 16px 34px;
}

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

.checkout-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 14px;
  margin-bottom: 10px;
}

.checkout-section h2 {
  margin: 0 0 4px;
  font-size: 34px;
  line-height: 1.1;
}

.checkout-section h3 {
  margin: 0 0 6px;
  font-size: 26px;
}

.checkout-helper {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.checkout-provider-switch {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.stripe-card-fields {
  margin-top: 8px;
  border-top: 1px solid #e8ebf2;
  padding-top: 10px;
}

.checkout-field {
  margin-top: 10px;
}

.checkout-field label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 700;
}

.checkout-field input,
.checkout-field select,
.checkout-field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c4cad7;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 11px;
  font-size: 15px;
}

.checkout-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkout-check {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
  color: #3f4656;
}

.checkout-check.disabled {
  opacity: 0.5;
}

.checkout-check input {
  margin-top: 3px;
  width: 19px;
  height: 19px;
  accent-color: #1f232c;
}

.error-text {
  color: var(--error-text);
}

.checkout-buy {
  margin-top: 12px;
  width: 100%;
  min-height: 44px;
  border: 1px solid #9fa5b2;
  border-radius: 8px;
  background: #9ea1a9;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.checkout-buy:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.checkout-summary {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 14px;
}

.checkout-summary h2 {
  margin: 0 0 8px;
  font-size: 34px;
}

.summary-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid #eceff4;
}

.summary-item img {
  width: 72px;
  height: 46px;
  object-fit: contain;
  background: #f8f9fb;
  border: 1px solid #eceff5;
  border-radius: 4px;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
}

.checkout-status {
  margin-top: 10px;
  border: 1px solid #ced4e0;
  border-radius: 8px;
  background: #f4f7fc;
  color: #2d3a4f;
  padding: 10px 12px;
  font-size: 14px;
}

.checkout-status.success {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success-text);
}

.checkout-status.error {
  border-color: var(--error-line);
  background: var(--error-bg);
  color: var(--error-text);
}

.checkout-muted {
  margin-top: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.simple-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 34px;
}

.simple-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}

.simple-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 44px);
}

.simple-panel h2 {
  margin: 20px 0 8px;
  font-size: clamp(24px, 3vw, 32px);
}

.simple-panel p {
  margin: 0 0 12px;
  color: #3f4656;
  font-size: 16px;
}

.simple-panel ul {
  margin: 0 0 14px 22px;
  color: #3f4656;
}

.registry-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.registry-table th,
.registry-table td {
  border: 1px solid #dce1ea;
  padding: 10px;
  text-align: left;
  font-size: 14px;
}

.registry-table th {
  background: #f7f8fb;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: #687286;
}

@media (max-width: 960px) {
  .product-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .price-card {
    position: static;
  }

  .checkout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .school-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  main {
    padding: 16px 12px 26px;
  }

  .topbar {
    padding: 10px 12px;
    font-size: 14px;
  }

  .brandbar {
    min-height: 64px;
    padding: 8px 10px;
  }

  .brand-logo {
    max-height: 42px;
  }

  .hero {
    padding: 18px;
  }

  .auth-wrap {
    margin: 16px auto;
    padding: 16px;
  }

  .auth-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-actions {
    flex-direction: column;
  }

  .return-admin-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .school-header-inner {
    min-height: 62px;
  }

  .school-header-logo {
    max-height: 40px;
  }

  .product-shell,
  .checkout-shell,
  .simple-page {
    padding: 14px 10px 22px;
  }

  .product-panel,
  .curriculum-wrap,
  .checkout-section,
  .checkout-summary,
  .simple-panel {
    padding: 12px;
  }

  .section-toggle {
    grid-template-columns: 1fr auto;
  }

  .section-chevron {
    display: none;
  }

  .checkout-inline {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-total {
    font-size: 24px;
  }
}

@media (max-width: 420px) {
  .auth-tab {
    font-size: 13px;
    padding: 8px 6px;
  }

  .account-dropdown {
    width: min(280px, 92vw);
  }

  .price-chip {
    font-size: 15px;
  }
}
