:root {
  --ink: #10211f;
  --muted: #65716e;
  --line: #dce7e4;
  --surface: #ffffff;
  --background: #f3f6f4;
  --green: #0d6b5c;
  --green-dark: #0d3b36;
  --accent: #f18f4a;
  --shadow: 0 18px 48px rgba(16, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(13, 107, 92, 0.1), rgba(243, 246, 244, 0) 300px),
    var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100%, 560px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
  display: grid;
  align-items: center;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(13, 107, 92, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.brand img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 7.5vw, 2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.steps li {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
  font-size: 0.78rem;
  font-weight: 900;
}

.steps li::before {
  content: attr(data-step-dot);
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #9aa8a4;
  border-radius: 999px;
  font-size: 0.72rem;
}

.steps li.active {
  color: var(--green-dark);
  border-color: rgba(13, 107, 92, 0.32);
  background: rgba(13, 107, 92, 0.08);
}

.steps li.active::before {
  background: var(--green);
}

.form,
.step-pane {
  display: grid;
  gap: 14px;
}

.step-pane {
  display: none;
}

.step-pane.active {
  display: grid;
}

label {
  display: grid;
  gap: 7px;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 900;
}

input[type="text"],
input[type="tel"],
input[type="email"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fbfdfc;
  outline: none;
}

input[type="file"] {
  width: 100%;
  min-height: 48px;
  border: 1px dashed rgba(13, 107, 92, 0.38);
  border-radius: 8px;
  padding: 12px;
  background: rgba(13, 107, 92, 0.06);
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13, 107, 92, 0.16);
}

.otp-box,
.challenge,
.hash-box,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #f9fbfa;
}

.otp-box p,
.empty-state p {
  margin: 0 0 10px;
}

.debug-code {
  color: var(--green-dark);
  font-weight: 900;
}

.challenge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.challenge span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.challenge strong {
  color: var(--green-dark);
  font-size: 1.2rem;
}

.upload-field {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.upload-field legend {
  padding: 0 6px;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 900;
}

.upload-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-options label {
  min-width: 0;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preview-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.preview-grid figcaption {
  padding: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.signature-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.signature-head {
  min-height: 48px;
  padding: 8px 10px 8px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--green-dark);
  font-weight: 900;
  border-bottom: 1px solid var(--line);
  background: #f9fbfa;
}

canvas {
  display: block;
  width: 100%;
  height: min(42dvh, 310px);
  min-height: 250px;
  background: #fff;
  touch-action: none;
}

.check {
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}

.check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 2px;
}

.actions:has(.secondary:not([hidden])) {
  grid-template-columns: 0.7fr 1fr;
}

.primary,
.secondary,
.ghost,
.download {
  min-height: 46px;
  border-radius: 8px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
}

.primary {
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 22px rgba(13, 107, 92, 0.22);
}

.secondary,
.ghost {
  color: var(--green-dark);
  background: rgba(13, 107, 92, 0.08);
}

.ghost {
  min-height: 36px;
  padding: 0 12px;
}

.primary:disabled,
.secondary:disabled {
  cursor: wait;
  opacity: 0.72;
}

.download {
  width: 100%;
  color: var(--green-dark);
  border: 1px solid rgba(241, 143, 74, 0.5);
  background: rgba(241, 143, 74, 0.12);
}

.result {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.result strong,
.hash-box code,
.verify-list code {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.hash-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--green-dark);
  font-weight: 900;
}

.verify-list {
  display: grid;
  gap: 9px;
  margin: 0 0 14px;
}

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

.verify-list dt {
  color: var(--green-dark);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.verify-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.event-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.event-list h2 {
  margin: 0;
  color: var(--green-dark);
  font-size: 1.1rem;
}

.event-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfa;
}

.event-list article strong,
.event-list article span {
  display: block;
}

.event-list article span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.event-list article p {
  margin: 8px 0 0;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  margin: 0 auto;
  width: min(460px, calc(100% - 28px));
  padding: 13px 14px;
  color: #fff;
  background: var(--green-dark);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 390px) {
  .panel {
    padding: 14px;
  }

  .brand img {
    width: 60px;
    height: 60px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .upload-options {
    grid-template-columns: 1fr;
  }

  .steps li {
    font-size: 0.72rem;
  }
}
