:root {
  --page: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dde5;
  --line-strong: #b8c2cf;
  --primary: #075e54;
  --primary-dark: #04443d;
  --blue: #1f5d8f;
  --danger: #b42318;
  --success: #067647;
  --warning: #a15c07;
  --shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
  --radius: 8px;
  --field-height: 48px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Aptos", "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.2rem;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.2;
}

h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

h4 {
  margin-bottom: 0.35rem;
  font-size: 0.98rem;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.public-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 1rem 1rem 6.5rem;
}

.public-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 0 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.public-header p {
  margin-bottom: 0;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(7, 94, 84, 0.18);
}

.wizard-card,
.success-card,
.auth-card,
.panel,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.wizard-card,
.success-card,
.auth-card {
  padding: 1rem;
}

.wizard-topbar,
.progress-meta,
.section-head,
.panel-header,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.wizard-topbar {
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.wizard-topbar p:last-child {
  margin-bottom: 0;
  max-width: 760px;
  color: var(--muted);
}

.autosave-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.autosave-pill {
  background: #edf7f5;
  color: var(--primary-dark);
  border: 1px solid #b8ded8;
}

.progress-block {
  margin: 1rem 0 1.15rem;
}

.progress-meta {
  margin-bottom: 0.55rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-meta strong {
  color: var(--ink);
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
}

.progress-bar-fill {
  width: 20%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--blue));
  border-radius: inherit;
  transition: width 0.25s ease;
}

.form-step {
  display: none;
  padding-top: 0.25rem;
}

.form-step.is-active {
  display: block;
}

.section-head {
  align-items: baseline;
  margin-bottom: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.section-head span {
  display: inline-flex;
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  gap: 0.9rem 1rem;
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 0.38rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  min-height: 20px;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: var(--field-height);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.72rem 0.8rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field select {
  cursor: pointer;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.field input[readonly] {
  background: var(--surface-soft);
  color: #475467;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(7, 94, 84, 0.13);
}

.field-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 0.8rem;
}

.address-note {
  margin-top: 0.9rem;
  padding: 0.72rem 0.85rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.is-invalid {
  border-color: var(--danger) !important;
  background: #fff8f7 !important;
}

.consent-card,
.summary-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.checkbox-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
  color: #344054;
}

.checkbox-card input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 0.18rem;
  accent-color: var(--primary);
}

.info-link-row {
  display: grid;
  gap: 0.25rem;
  margin: 0.85rem 0 1rem;
  padding: 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.info-link-row span {
  color: #344054;
  font-size: 0.9rem;
  font-weight: 800;
}

.info-link-row a {
  overflow-wrap: anywhere;
}

.summary-box {
  margin-top: 1rem;
}

.summary-box p {
  margin-bottom: 0;
  color: var(--muted);
}

.sticky-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0.8rem 1rem max(0.8rem, env(safe-area-inset-bottom));
  background: rgba(245, 247, 250, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 10;
}

#submit-button {
  grid-column: 1 / -1;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.72rem 1rem;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.button:hover {
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
}

.button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  box-shadow: none;
}

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

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

.button-secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
}

.button-full {
  width: 100%;
}

.alert {
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-weight: 650;
}

.alert-danger {
  background: #fff3f1;
  border: 1px solid #f4c7c1;
  color: var(--danger);
}

.alert-success {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: var(--success);
}

.success-card {
  max-width: 620px;
  margin: 3rem auto 0;
  text-align: left;
}

.success-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: #ecfdf3;
  color: var(--success);
  font-weight: 900;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.theme-admin {
  background: var(--page);
  color: var(--ink);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.admin-sidebar {
  background: #17202a;
  color: #fff;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-logo {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 850;
  text-decoration: none;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1rem 0;
}

.admin-nav a {
  color: #d0d5dd;
  font-weight: 700;
  text-decoration: none;
}

.admin-user {
  display: grid;
  gap: 0.15rem;
  margin-bottom: 1rem;
  color: #d0d5dd;
  font-size: 0.9rem;
}

.admin-main {
  padding: 1rem;
}

.admin-section {
  display: grid;
  gap: 1rem;
}

.section-heading {
  align-items: center;
}

.section-subline {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.stats-grid,
.detail-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.stat-card,
.panel {
  padding: 1rem;
}

.stat-card {
  box-shadow: none;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--ink);
  font-size: 1.85rem;
  line-height: 1;
}

.filters-bar {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.data-table th,
.data-table td {
  padding: 0.78rem 0.72rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--surface-soft);
  color: #475467;
  font-size: 0.82rem;
  font-weight: 850;
}

.data-table tr:hover td {
  background: #fbfcfe;
}

.badge-new {
  background: #eef4ff;
  color: #1849a9;
}

.badge-progress {
  background: #fff7e6;
  color: var(--warning);
}

.badge-success {
  background: #ecfdf3;
  color: var(--success);
}

.badge-danger {
  background: #fff3f1;
  color: var(--danger);
}

.stack {
  display: grid;
  gap: 0.9rem;
}

.detail-columns {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.detail-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
}

.detail-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.timeline {
  display: grid;
  gap: 0.8rem;
}

.timeline-item {
  padding: 0.85rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.timeline-item span {
  display: block;
  margin: 0.15rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-card {
  max-width: 460px;
  margin: 4rem auto;
}

.honeypot {
  display: none !important;
}

.gate-card .gate-form {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.gate-card .gate-form .button {
  width: 100%;
  justify-content: center;
}

.gate-error {
  margin-top: 0.75rem;
}

@media (min-width: 720px) {
  .public-shell {
    padding: 1.25rem 1.25rem 6.75rem;
  }

  .wizard-card,
  .success-card,
  .auth-card {
    padding: 1.35rem;
  }

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

  .sticky-actions {
    left: 50%;
    width: min(100%, 1080px);
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }

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

  .filters-bar {
    grid-template-columns: 2fr 1fr auto;
    align-items: end;
  }

  .detail-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .detail-grid-lower {
    grid-template-columns: 1.25fr 0.75fr;
  }

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

@media (min-width: 980px) {
  .admin-shell {
    grid-template-columns: 260px 1fr;
  }

  .admin-sidebar {
    min-height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 0;
  }

  .admin-nav {
    flex-direction: column;
  }

  .admin-main {
    padding: 1.5rem;
  }
}

@media (max-width: 520px) {
  .public-header {
    align-items: flex-start;
  }

  .wizard-topbar,
  .progress-meta,
  .section-head,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .autosave-pill {
    align-self: flex-start;
  }

  .success-actions .button {
    width: 100%;
  }
}
