:root {
  --cream: #fdf8f0;
  --cream-deep: #f4e8d8;
  --paper: #fffdf9;
  --charcoal: #221e1d;
  --ink: #2a1a13;
  --muted: #675044;
  --terracotta: #c96442;
  --terracotta-dark: #9f4027;
  --amber: #d89027;
  --line: #dbc8b1;
  --danger: #9b2c24;
  --success: #356641;
  --focus: #166f8f;
  --radius: 14px;
  --shadow: 0 12px 34px rgba(51, 32, 26, 0.08);
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: var(--cream);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select {
  min-height: 44px;
}

a {
  color: var(--terracotta-dark);
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(100% - 32px, 1040px);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--charcoal);
  color: white;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid #443a36;
  background: var(--charcoal);
  color: white;
}

.header-row {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 0;
  place-items: center;
  border: 2px solid var(--terracotta);
  border-radius: 50%;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

main {
  width: 100%;
  flex: 1 0 auto;
  min-height: calc(100vh - 158px);
  padding-block: 42px 72px;
}

.intro {
  max-width: 760px;
  margin-bottom: 32px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--terracotta-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--charcoal);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.course-name {
  margin: 10px 0 0;
  color: var(--terracotta);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

h1 {
  max-width: 18ch;
  margin-top: 12px;
  font-size: clamp(2.1rem, 8vw, 4.2rem);
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

h3 {
  font-size: 1.18rem;
}

p {
  margin: 0 0 16px;
}

.lead {
  max-width: 65ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.08rem;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 40px;
  align-items: start;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.auth-layout > div:first-child p:last-child {
  margin-top: 18px;
  color: var(--muted);
}

.form-surface,
.status-panel,
.stage-form,
.completion-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.form-surface,
.status-panel,
.completion-panel {
  padding: clamp(22px, 4vw, 36px);
}

.field {
  margin-bottom: 24px;
}

label,
legend {
  display: block;
  margin-bottom: 8px;
  color: var(--charcoal);
  font-weight: 720;
}

fieldset {
  min-width: 0;
  margin: 0 0 26px;
  padding: 0;
  border: 0;
}

fieldset legend {
  width: 100%;
}

input[type="email"],
input[type="text"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #9b8676;
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border: 2px solid var(--danger);
}

fieldset[aria-invalid="true"] .choice {
  border-color: var(--danger);
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 650;
}

.choice-list {
  display: grid;
  gap: 8px;
}

.choice {
  display: flex;
  min-height: 48px;
  align-items: flex-start;
  gap: 11px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 500;
  cursor: pointer;
}

.choice input {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 2px 0 0;
  accent-color: var(--terracotta-dark);
}

.choice:hover,
.choice:focus-within {
  border-color: var(--terracotta-dark);
  background: #fff8f2;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 1px solid var(--terracotta-dark);
  border-radius: 9px;
  background: var(--terracotta-dark);
  color: white;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  border-color: #7d2f1d;
  background: #7d2f1d;
}

.button-secondary,
.button-quiet {
  border-color: var(--terracotta-dark);
  background: transparent;
  color: var(--terracotta-dark);
}

.site-header .button-quiet {
  border-color: #d5a08b;
  color: white;
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.notice {
  padding: 14px 16px;
  border-left: 4px solid var(--amber);
  background: #fff4df;
  color: #523b2e;
}

.error-summary {
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 2px solid var(--danger);
  border-radius: 10px;
  background: #fff6f4;
}

.error-summary h2 {
  font-size: 1.2rem;
}

.error-summary ul {
  margin: 10px 0 0;
  padding-left: 22px;
}

.error-summary a {
  color: var(--danger);
  font-weight: 700;
}

.status-panel {
  max-width: 690px;
}

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}

.access-date {
  margin: 0;
  color: var(--muted);
}

.progress-block {
  margin-block: 28px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 9px;
}

.progress-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: #e3d4c1;
}

.progress-fill {
  display: block;
  height: 100%;
  background: var(--terracotta);
}

.progress-0 {
  width: 0;
}

.progress-33 {
  width: 33%;
}

.progress-67 {
  width: 67%;
}

.progress-100 {
  width: 100%;
}

.stage-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.stage-summary {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 5px solid #9a8778;
  border-radius: 10px;
  background: var(--paper);
}

.stage-summary[data-status="available"] {
  border-top-color: var(--terracotta);
}

.stage-summary[data-status="completed"] {
  border-top-color: var(--success);
}

.stage-day,
.stage-status {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stage-summary strong {
  display: block;
  margin-block: 6px;
}

.stage-status {
  font-weight: 720;
}

.stage-form {
  padding: clamp(22px, 5vw, 42px);
}

.stage-form header {
  margin-bottom: 30px;
}

.stage-form header p {
  margin: 10px 0 0;
  color: var(--muted);
}

.readonly-list {
  display: grid;
  gap: 18px;
  margin: 22px 0 0;
}

.readonly-list div {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.readonly-list dt {
  font-weight: 750;
}

.readonly-list dd {
  margin: 5px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.completion-panel {
  margin-top: 28px;
  border-top: 5px solid var(--success);
}

.completion-panel h2 {
  max-width: 20ch;
}

.completion-panel p {
  max-width: 68ch;
  margin-top: 14px;
}

footer {
  padding-block: 26px;
  border-top: 1px solid var(--line);
  background: var(--cream-deep);
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

@media (max-width: 768px) {
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .dashboard-heading {
    display: block;
  }

  .access-date {
    margin-top: 14px;
  }

  .stage-list {
    grid-template-columns: 1fr;
  }

  .stage-summary {
    min-height: 0;
  }
}

@media (max-width: 375px) {
  .shell {
    width: min(100% - 22px, 1040px);
  }

  .brand > span:last-child {
    display: none;
  }

  main {
    padding-top: 30px;
  }

  .button-row .button {
    width: 100%;
  }
}

@media (min-width: 1024px) {
  main {
    padding-block: 56px 88px;
  }
}

@media (min-width: 1440px) {
  .shell {
    max-width: 1120px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  main {
    padding-block: 24px 42px;
  }

  .intro {
    margin-bottom: 20px;
  }

  .stage-summary {
    min-height: 104px;
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 28px;
}

.stat-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.6rem;
  line-height: 1.1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.results-table th,
.results-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.results-table thead th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-email {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.results-table .button {
  width: max-content;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.88rem;
}

#detail-email {
  margin: 8px 0 0;
}

#detail-content {
  display: grid;
  gap: 22px;
  margin-top: 28px;
}

#detail-content .stage-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

#detail-content .stage-form h3 {
  margin: 0 0 18px;
}

@media (min-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
