:root {
  --portal-violet: #4f2b62;
  --portal-gold: #b58a42;
  --portal-paper: #fbf8f4;
  --portal-line: #dfd4e2;
  --portal-muted: #6d6371;
}

.portal-body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(135deg, #f1e9f3, #fffaf6 55%, #efe5f2);
  color: #2e2531;
}

.portal-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 74px;
  padding: 0.5rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(255,255,255,.18);
  background: var(--portal-violet);
  color: white;
}

.portal-brand img { width: 105px; max-height: 60px; object-fit: contain; }
.portal-header nav { display: flex; gap: 1rem; align-items: center; }
.portal-header a { color: white; font-weight: 800; text-decoration: none; }
.portal-header nav span { opacity: .75; }
.portal-main { width: min(1180px, calc(100% - 2rem)); min-height: calc(100vh - 150px); margin: 0 auto; padding: 2rem 0 4rem; }
.portal-footer { padding: 1.5rem; background: var(--portal-violet); color: white; text-align: center; }

.portal-card {
  border: 1px solid var(--portal-line);
  border-radius: .75rem;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  background: rgba(255,255,255,.94);
  box-shadow: 0 20px 60px rgba(44,22,54,.12);
}

.portal-body h1,
.portal-body h2,
.portal-body h3,
.portal-body h4,
.portal-body h5,
.portal-body h6 {
  margin: .3rem 0 .6rem;
  color: var(--portal-violet);
  font-family: Georgia, "Times New Roman", serif;
  font-style: normal;
  font-weight: 400;
  line-height: 1.15;
}

.portal-heading h1,
.portal-card h1 {
  font-size: clamp(1.45rem, 2.3vw, 2.4rem);
}

.portal-card h2 {
  font-size: clamp(1.25rem, 1.8vw, 1.9rem);
}

.portal-body h3 {
  font-size: clamp(1.15rem, 1.7vw, 1.55rem);
}

.portal-body .section-kicker {
  color: var(--portal-gold) !important;
  font-family: Arial, Helvetica, sans-serif;
  font-size: .7rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.auth-card { width: min(520px, 100%); margin: 5vh auto; }
.auth-help { margin: 1.2rem 0 0; color: var(--portal-muted); font-size: .88rem; }
.portal-form { display: grid; gap: 1rem; margin-top: 1.4rem; }
.portal-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.portal-form label { display: grid; gap: .4rem; color: var(--portal-violet); font-size: .82rem; font-weight: 900; }
.portal-form input, .portal-form select, .portal-form textarea {
  min-width: 0; border: 1px solid var(--portal-line); border-radius: .4rem; padding: .78rem; background: white; color: #2e2531; font: inherit;
}
.portal-form input:focus, .portal-form select:focus, .portal-form textarea:focus { outline: 3px solid rgba(79,43,98,.14); border-color: var(--portal-violet); }
.portal-checkbox { display: flex !important; grid-column: 1/-1; flex-direction: row; align-items: center; }
.portal-checkbox input { min-width: auto; }
.portal-course-selector { grid-column: 1/-1; margin: 0; border: 1px solid var(--portal-line); border-radius: .55rem; padding: 1rem; }
.portal-course-selector legend { padding: 0 .35rem; color: var(--portal-violet); font-weight: 900; }
.portal-course-selector > p { margin: 0 0 .8rem; color: var(--portal-muted); font-size: .86rem; }
.portal-course-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.portal-course-options label { display: flex; flex-direction: row; align-items: flex-start; gap: .5rem; border: 1px solid var(--portal-line); border-radius: .4rem; padding: .7rem; background: white; }
.portal-course-options input { width: auto; min-width: auto; margin-top: .15rem; }
.portal-actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.portal-alert { margin-bottom: 1rem; border-radius: .45rem; padding: .85rem 1rem; background: #e5f4ea; color: #185d33; font-weight: 800; }
.portal-alert.error { background: #fde9e7; color: #8a2922; }
.portal-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1.5rem; }
.portal-heading p { margin: 0; color: var(--portal-muted); }
.portal-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.portal-tabs a { border-radius: 999px; padding: .6rem 1rem; background: white; color: var(--portal-violet); font-weight: 900; text-decoration: none; }
.portal-tabs a.active { background: var(--portal-violet); color: white; }
.table-wrap { overflow-x: auto; border: 1px solid var(--portal-line); border-radius: .6rem; background: white; }
.portal-table { width: 100%; border-collapse: collapse; }
.portal-table th, .portal-table td { padding: .78rem; border-bottom: 1px solid var(--portal-line); text-align: left; vertical-align: top; }
.portal-table th { background: #f0e9f2; color: var(--portal-violet); font-size: .76rem; text-transform: uppercase; }
.portal-table tr:last-child td { border-bottom: 0; }
.status-pill { display: inline-block; border-radius: 999px; padding: .25rem .55rem; background: #e6f4eb; color: #1e6338; font-size: .74rem; font-weight: 900; }
.status-pill.expired, .status-pill.inactive { background: #f8e4e2; color: #8d2b25; }
.status-pill.pending { background: #fff2cf; color: #785b15; }
.status-select { border: 1px solid var(--portal-line); border-radius: 999px; padding: .55rem .75rem; font-weight: 900; }
.status-select.status-pending { background: #f1eef2; color: #625967; }
.status-select.status-approved { border-color: #9ac8a8; background: #e6f4eb; color: #1e6338; }
.status-select.status-rejected { border-color: #e0aaa5; background: #f8e4e2; color: #8d2b25; }
.status-select.status-refunded { border-color: #9ebbd8; background: #e5f0fa; color: #285b88; }
.link-button { border: 0; padding: 0; background: transparent; color: #8d2b25; cursor: pointer; font: inherit; font-weight: 800; }
.course-library { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.course-library article { display: grid; gap: .7rem; }
.course-library p { margin: 0; color: var(--portal-muted); }
.lesson-list { display: grid; gap: 1.25rem; }
.lesson-card { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.lesson-card > div:last-child { max-width: 900px; }
.lesson-video { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: .55rem; background: #160f19; }
.lesson-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-number { color: var(--portal-gold); font-weight: 900; text-transform: uppercase; }
.lesson-description a {
  color: var(--portal-violet);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--portal-gold);
  text-decoration-thickness: 2px;
  text-underline-offset: .18em;
}
.lesson-description a:hover,
.lesson-description a:focus-visible { color: var(--portal-gold); }
.empty-state { padding: 2rem; color: var(--portal-muted); text-align: center; }

@media (max-width: 760px) {
  .portal-header { align-items: flex-start; }
  .portal-header nav { flex-direction: column; gap: .35rem; align-items: flex-end; font-size: .82rem; }
  .portal-header nav span { display: none; }
  .portal-form-grid, .portal-course-options, .course-library, .lesson-card { grid-template-columns: 1fr; }
  .portal-heading { align-items: flex-start; flex-direction: column; }
}
