:root {
  --lec-blue: #1248b5;
  --lec-blue-dark: #0d3689;
  --lec-indigo: #1f215a;
  --charcoal: #34373c;
  --offwhite: #f7f7f7;
  --white: #ffffff;
  --border: #e2e2e6;

  --amber-bg: #fef3c7;
  --amber-border: #f2c14e;
  --amber-text: #7a4d00;

  --red-bg: #fdecea;
  --red-border: #e8a29c;
  --red-text: #9a2f27;

  --green-bg: #e6f4ea;
  --green-border: #9fd6ae;
  --green-text: #1d6b34;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(31, 33, 90, 0.06), 0 2px 8px rgba(31, 33, 90, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--offwhite);
  color: var(--charcoal);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  color: var(--charcoal);
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
}

p {
  margin: 0 0 12px;
  line-height: 1.5;
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ---------- full-page states (auth loading / access denied / fatal) ---------- */

.full-page-message {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  gap: 8px;
}

.full-page-message h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.full-page-message p {
  max-width: 420px;
  color: var(--charcoal);
}

/* ---------- spinner ---------- */

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--lec-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  color: #6b6e73;
  font-size: 14px;
}

/* ---------- header ---------- */

.header-band {
  background: var(--lec-blue);
  padding: 16px 20px;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-left .logo {
  display: block;
  width: 120px;
  height: auto;
}

.header-left h1 {
  color: var(--white);
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  color: var(--white);
  font-size: 14px;
  opacity: 0.9;
}

/* ---------- layout ---------- */

.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.footer {
  padding: 24px 16px 40px;
}

.footer-inner {
  max-width: 720px;
  margin: 0 auto;
  color: #8b8e93;
  font-size: 12px;
  text-align: center;
}

/* ---------- banners ---------- */

.banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.banner-error {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
}

.banner-warning {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: var(--amber-text);
}

.banner-dismiss {
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.7;
}

.banner-dismiss:hover {
  opacity: 1;
}

/* ---------- stat tiles ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 620px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-tile {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.stat-label {
  font-size: 12px;
  color: #6b6e73;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--lec-indigo);
  margin-bottom: 4px;
}

.stat-value.skeleton {
  background: linear-gradient(90deg, #e9e9ee 25%, #f4f4f7 37%, #e9e9ee 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 4px;
  height: 24px;
  width: 60%;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.stat-note {
  font-size: 11px;
  color: #9a9da3;
}

/* ---------- card / wizard ---------- */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.step-indicator {
  display: flex;
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  gap: 8px;
}

.step-dot {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--border);
  color: #9a9da3;
  font-size: 13px;
}

.step-dot.active {
  border-bottom-color: var(--lec-blue);
  color: var(--lec-indigo);
  font-weight: 600;
}

.step-dot.completed {
  border-bottom-color: var(--lec-blue);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--charcoal);
  font-size: 11px;
  flex-shrink: 0;
}

.step-dot.active .step-number,
.step-dot.completed .step-number {
  background: var(--lec-blue);
  color: var(--white);
}

.step-label {
  white-space: nowrap;
}

.section-subheading {
  margin-top: 20px;
}

/* ---------- group list ---------- */

.group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.group-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
}

.group-card:has(input:checked) {
  border-color: var(--lec-blue);
  background: #f2f6fd;
}

.group-card input[type='radio'] {
  margin-top: 3px;
  flex-shrink: 0;
}

.group-card-label {
  font-weight: 600;
  color: var(--charcoal);
}

.group-card-meta {
  font-size: 13px;
  color: #6b6e73;
  margin-top: 2px;
}

.group-card-explain {
  font-size: 12px;
  color: var(--red-text);
  margin-top: 4px;
}

.group-card-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- segmented control ---------- */

.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}

.segmented-option {
  position: relative;
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  color: var(--charcoal);
  border-right: 1px solid var(--border);
}

.segmented-option:last-child {
  border-right: none;
}

.segmented-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-option:has(input:checked) {
  background: var(--lec-blue);
  color: var(--white);
  font-weight: 600;
}

/* ---------- form fields ---------- */

.field {
  margin-top: 16px;
  margin-bottom: 4px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.field input[type='text'],
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--charcoal);
  resize: vertical;
}

.field input[type='text']:focus,
.field textarea:focus {
  outline: 2px solid var(--lec-blue);
  outline-offset: 1px;
}

.counter-row {
  font-size: 13px;
  color: #6b6e73;
  margin-top: 8px;
}

.cost-line {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--lec-indigo);
}

/* ---------- confirm summary ---------- */

.summary-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0 0 20px;
  font-size: 14px;
}

.summary-list dt {
  color: #6b6e73;
}

.summary-list dd {
  margin: 0;
  color: var(--charcoal);
  font-weight: 600;
}

.message-preview {
  background: var(--offwhite);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.message-preview-subject {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--charcoal);
}

.message-preview-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--charcoal);
  line-height: 1.5;
}

.confirm-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 20px;
  cursor: pointer;
}

.confirm-checkbox-row input {
  margin-top: 3px;
}

/* ---------- buttons ---------- */

.step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--lec-blue);
  color: var(--white);
}

.btn-primary:not(:disabled):hover {
  background: var(--lec-blue-dark);
}

.btn-secondary {
  background: var(--white);
  color: var(--charcoal);
  border: 1px solid var(--border);
}

.btn-secondary:not(:disabled):hover {
  background: var(--offwhite);
}

.btn-ghost-inverse {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 7px 14px;
  font-size: 13px;
}

.btn-ghost-inverse:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- status view ---------- */

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--lec-blue);
  width: 0%;
  transition: width 0.4s ease;
}

#progress-text {
  font-size: 13px;
  color: #6b6e73;
  margin-bottom: 4px;
}

.status-note {
  font-size: 13px;
  color: var(--amber-text);
}

.status-summary {
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0;
  border: 1px solid transparent;
}

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

.status-summary-warning {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: var(--amber-text);
}

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

.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.result-table th,
.result-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.result-table th {
  color: #6b6e73;
  font-weight: 600;
}

/* ---------- small screens (Karen on her phone) ---------- */

@media (max-width: 420px) {
  .card {
    padding: 18px;
  }

  .header-left .logo {
    width: 96px;
  }

  .header-left h1 {
    font-size: 16px;
  }

  .step-label {
    display: none;
  }

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

  .summary-list dd {
    margin-bottom: 6px;
  }
}
