:root {
  --bg: #ffffff;
  --text: #0f1012;
  --muted: #a9adb4;
  --line: #c7cad0;
  --brand: #10b26c;
  --brand-deep: #08a964;
  --card-soft: #f7f8fa;
  --focus-ring: rgba(16, 178, 108, 0.2);
  --content-max: 430px;
  --pad-x: clamp(16px, 4.8vw, 24px);
  --vvh: 100dvh;
  --keyboard-lift: 0px;
  --submit-idle: #87d8b3;
  --submit-active: #08b05a;
  --submit-text: #effaf3;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", "Nunito", "Avenir Next", "Segoe UI", sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(150px 80px at 88% 0%, rgba(16, 178, 108, 0.08), transparent 72%),
    radial-gradient(190px 110px at 7% 100%, rgba(16, 178, 108, 0.05), transparent 75%),
    var(--bg);
}

.page {
  width: min(100%, var(--content-max));
  height: var(--vvh);
  padding: max(6px, env(safe-area-inset-top)) var(--pad-x) max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
}

.form-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: calc(var(--vvh) - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
}

.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: clamp(-2px, 0.2vh, 2px);
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: clamp(5px, 1.6vw, 8px);
  height: clamp(32px, 8vw, 40px);
  padding: 0 clamp(10px, 2.4vw, 14px);
  border: 0;
  border-radius: 999px;
  background: #050505;
  color: #ffffff;
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(9, 10, 10, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.help-icon {
  width: clamp(14px, 3.8vw, 18px);
  height: clamp(14px, 3.8vw, 18px);
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  display: grid;
  place-items: center;
  font-size: clamp(9px, 2.2vw, 12px);
  font-weight: 700;
  line-height: 1;
}

.brand {
  margin: clamp(8px, 2.2vh, 16px) 0 clamp(4px, 1.2vh, 10px);
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(92px * var(--logo-s, 1));
}

.brand-mark {
  width: auto;
  height: calc(92px * var(--logo-s, 1));
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.intake-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-bottom: calc(clamp(58px, 14vw, 82px) + 18px + env(safe-area-inset-bottom));
  gap: clamp(8px, 2.2vw, 14px);
}

.field-row {
  display: grid;
  grid-template-columns: minmax(72px, 22%) 1fr;
  gap: clamp(8px, 2.8vw, 14px);
}

.prefix-box,
.field1-wrap {
  border: 2px solid #eef2f6;
  background: linear-gradient(180deg, #f8f9fb 0%, #f4f6f9 100%);
  border-radius: clamp(18px, 4.8vw, 24px);
  height: clamp(70px, 18vw, 88px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 2px 8px rgba(17, 20, 24, 0.025);
}

.field1-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-right: 0;
}

.field1-wrap.has-mask {
  padding-right: 8px;
}

.field1-wrap:focus-within {
  border-color: #b8c0ca;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(16, 178, 108, 0.05);
}

.prefix-box {
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: clamp(15px, 4vw, 20px);
  padding: 0 8px;
  text-align: center;
  line-height: 1.15;
}

.field1-input {
  width: 100%;
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0 clamp(14px, 3.8vw, 24px);
  color: #171c22;
  font-weight: 500;
  font-size: clamp(20px, 5.8vw, 36px);
  transition: box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.field1-input::placeholder {
  color: #b1b8c2;
}

.field1-input.is-masked,
.field-input.is-masked {
  -webkit-text-security: disc;
}

.field1-input:focus,
.field-input:focus {
  outline: 0;
  box-shadow: none;
}

.mask-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b4bac3;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mask-btn[hidden] {
  display: none !important;
}

.mask-btn svg {
  width: 20px;
  height: 20px;
  display: none;
}

.mask-btn .eye-open { display: block; }
.mask-btn.is-visible .eye-open { display: none; }
.mask-btn.is-visible .eye-closed { display: block; }
.mask-btn:hover { color: #5f6873; }
.mask-btn:active { transform: scale(0.96); }

.field-group {
  border: 2px solid #eef2f6;
  background: linear-gradient(180deg, #f8f9fb 0%, #f4f6f9 100%);
  border-radius: clamp(18px, 4.8vw, 24px);
  padding: clamp(10px, 2.7vw, 14px) clamp(14px, 3.8vw, 22px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 2px 8px rgba(17, 20, 24, 0.025);
}

.field-group:focus-within {
  border-color: #b8c0ca;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(16, 178, 108, 0.05);
}

.field-label {
  display: block;
  color: var(--brand);
  font-size: clamp(16px, 4.8vw, 30px);
  line-height: 1.1;
  margin-bottom: clamp(2px, 0.9vw, 5px);
  font-weight: 600;
}

.field-wrap {
  display: flex;
  align-items: center;
  gap: clamp(6px, 2vw, 10px);
}

.field-input {
  border: 0;
  width: 100%;
  min-width: 0;
  padding: 0;
  font-size: clamp(23px, 5.9vw, 38px);
  color: #171c22;
  background: transparent;
  transition: box-shadow 0.2s ease;
}

.field-input::placeholder {
  color: #b1b8c2;
  font-size: 0.84em;
}

.helper-link {
  text-align: center;
  text-decoration: none;
  color: var(--brand);
  font-size: clamp(15px, 4.1vw, 26px);
  font-weight: 500;
  margin: 2px 0 6px;
  transition: color 0.2s ease;
}

.submit-wrap {
  position: fixed;
  left: 50%;
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: min(calc(100% - (var(--pad-x) * 2)), var(--content-max));
  margin-top: 0;
  padding: 0;
  transform: translate(-50%, calc(-1 * var(--keyboard-lift)));
  transition: transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
  z-index: 20;
}

.submit-btn {
  border: 0;
  width: 100%;
  height: clamp(58px, 14vw, 82px);
  border-radius: clamp(18px, 5.4vw, 26px);
  background: var(--submit-idle);
  color: var(--submit-text);
  font-size: clamp(20px, 5.8vw, 34px);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  margin-top: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow:
    0 8px 20px rgba(16, 178, 108, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.16s ease, box-shadow 0.22s ease, filter 0.22s ease, background-color 0.2s ease, border-color 0.2s ease;
}

body.keyboard-open .page {
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

body.keyboard-open .brand {
  margin-top: clamp(8px, 2.2vh, 14px);
  margin-bottom: clamp(4px, 1vh, 8px);
}

body.keyboard-open .intake-form {
  gap: clamp(8px, 2.4vw, 14px);
  padding-bottom: calc(clamp(58px, 14vw, 82px) + 18px + env(safe-area-inset-bottom));
}

body.keyboard-open .helper-link {
  margin: 6px 0 8px;
}

body.form-ready .submit-btn {
  background: var(--submit-active);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 12px 26px rgba(10, 168, 88, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.help-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 20px rgba(9, 10, 10, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.submit-btn:hover {
  filter: saturate(1.04) brightness(1.01);
  box-shadow:
    0 13px 26px rgba(16, 178, 108, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.submit-btn:active,
.help-btn:active {
  transform: translateY(1px) scale(0.995);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.58);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  z-index: 80;
}

.loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  cursor: wait;
  transition: opacity 0.2s ease;
}

.loading-mark {
  width: clamp(90px, 24vw, 128px);
  height: auto;
}

.loading-mark-svg {
  width: 100%;
  height: auto;
  display: block;
}

.loading-mark-track,
.loading-mark-active {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loading-mark-track {
  stroke: rgba(255, 255, 255, 0.88);
}

.loading-mark-active {
  stroke: #06c867;
  stroke-dasharray: 56 220;
  animation: mark-run 1.1s linear infinite;
}

@keyframes mark-run {
  from {
    stroke-dashoffset: 0;
  }

  to {
    stroke-dashoffset: -278;
  }
}

.helper-link:hover {
  color: var(--brand-deep);
}

.help-btn:focus-visible,
.helper-link:focus-visible,
.submit-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

@media (max-width: 360px) {
  .helper-link {
    margin-bottom: 16px;
  }
}

@media (min-width: 768px) {
  .page {
    padding-top: 24px;
  }

  .brand {
    margin-top: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
    transition: none !important;
  }
}

.loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
}

.review-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 2px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.view-review {
  background: #ffffff;
}

body.view-review .page {
  padding-top: max(18px, env(safe-area-inset-top));
  overflow-x: hidden;
  overflow-y: auto;
}

body.view-review .review-hero,
body.view-review .note-entry,
body.view-review .below-block,
body.view-review .status-card,
body.view-review .review-helper,
body.view-review .review-footer {
  flex-shrink: 0;
}

body.view-review .intake-form,
body.view-review .submit-wrap,
body.view-review .helper-link,
body.view-review .help-btn,
body.view-review .top-bar {
  display: none !important;
}

body.view-review .review-panel {
  display: flex;
}

body.view-review .brand {
  display: none;
}

.review-hero {
  margin-top: clamp(36px, 8vh, 72px);
}

.review-title {
  margin: 0;
  font-size: clamp(32px, 8.4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: #111214;
}

.review-title .accent {
  color: #00a651;
  font-weight: 800;
}

.review-subtext {
  margin: 14px 0 0;
  color: #8b929c;
  font-size: clamp(14px, 3.7vw, 16px);
  line-height: 1.45;
  font-weight: 400;
  max-width: 92%;
}

.box-row {
  margin-top: 0;
  display: grid;
  gap: 8px;
  width: 100%;
}

.box-cell {
  width: 100%;
  height: 56px;
  border-radius: 16px;
  background: #f3f5f7;
  border: 1.5px solid transparent;
  text-align: center;
  color: #171c22;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 600;
  padding: 0;
}

.box-cell::placeholder {
  color: #c5cad1;
  font-weight: 500;
}

.box-cell:focus {
  outline: 0;
  background: #ffffff;
  border-color: #b7bec8;
  box-shadow: 0 0 0 1px rgba(17, 22, 30, 0.02);
}

.note-entry {
  margin-top: 22px;
}

.note-entry-label {
  display: none;
}

.note-input-field {
  width: 100%;
  height: 56px;
  border: 1.5px solid #dfe3e8;
  border-radius: 16px;
  background: #f6f8fb;
  padding: 0 16px;
  font-size: clamp(16px, 4.2vw, 20px);
  color: #171c22;
}

.note-input-field::placeholder {
  color: #9aa3ad;
}

.note-input-field:focus {
  outline: 0;
  background: #fff;
  border-color: #b7bec8;
  box-shadow: 0 0 0 2px rgba(16, 178, 108, 0.06);
}

.note-entry.is-boxes .note-input-field {
  display: none;
}

.note-added-hint {
  margin: 8px 0 0;
  color: #9aa3ad;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  flex-shrink: 0;
}

.note-added-hint.is-blank {
  display: none !important;
}

.status-card {
  margin-top: 18px;
  background: #fff;
  border: 1px solid #eef2f6;
  border-radius: 16px;
  padding: 14px 12px 12px;
}

.mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
}

.mark.pending { background: #fff6e8; color: #d9891d; animation: pulse 1.6s ease-in-out infinite; }
.mark.approved { background: #e9f9f0; color: var(--brand); }
.mark.rejected { background: #fdecec; color: #c63030; }
.mark.missing { background: var(--card-soft); color: #9aa3ad; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.status-value {
  margin: 0;
  text-align: center;
  font-size: clamp(16px, 4.2vw, 20px);
  font-weight: 700;
}

.status-value.pending { color: #d9891d; }
.status-value.approved { color: var(--brand); }
.status-value.rejected { color: #c63030; }

.note-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--card-soft);
}

.note-text {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
}

.meta {
  margin: 12px 0 0;
  color: #9aa3ad;
  font-size: 12px;
  text-align: center;
}

.note-save-btn {
  border: 0;
  width: 100%;
  margin-top: 36px;
  height: 54px;
  min-height: 54px;
  flex-shrink: 0;
  border-radius: 16px;
  background: #9ee0c0;
  color: #f7fffb;
  font-size: clamp(18px, 4.6vw, 22px);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 54px;
  padding: 0 16px;
  cursor: pointer;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

body.note-ready .note-save-btn {
  background: var(--submit-active);
  box-shadow: 0 10px 22px rgba(10, 168, 88, 0.28);
}

.note-save-btn.is-blank {
  display: none !important;
}

.note-save-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.below-block {
  margin-top: 28px;
  text-align: center;
}

.below-block.is-blank {
  display: none !important;
}

.below-hint {
  margin: 0;
  color: #9b9b9b;
  font-family: "Poppins", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 400;
}

.below-hint.is-blank {
  display: none !important;
}

.below-action {
  display: inline-block;
  border: 0;
  background: transparent;
  color: #00a651;
  margin-top: 10px;
  padding: 0;
  font-family: "Poppins", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
  cursor: pointer;
}

.below-action.is-blank {
  display: none !important;
}

.below-action:hover {
  color: #08964a;
}

.review-helper {
  margin-top: 28px;
  text-align: center;
}

.waiting {
  margin: 0;
  color: #8b929c;
  font-size: clamp(14px, 3.8vw, 16px);
  font-weight: 400;
}

.retry-btn {
  display: inline-block;
  border: 0;
  background: transparent;
  color: #00a651;
  height: auto;
  width: auto;
  margin-top: 8px;
  padding: 0;
  font-size: clamp(15px, 4vw, 17px);
  font-weight: 700;
  cursor: pointer;
}

.review-helper .is-blank {
  display: none !important;
}

.review-footer {
  margin-top: auto;
  padding-top: 28px;
  padding-bottom: 8px;
  text-align: center;
  color: #c2c7ce;
  font-size: 13px;
}

.review-footer.is-blank {
  visibility: hidden;
}

.hidden { display: none !important; }
