/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary:    #00A651;
  --dark:       #005C2D;
  --darker:     #003D1E;
  --light:      #8CC63F;
  --pale:       #E8F5E9;
  --text:       #1C1E21;
  --white:      #FFFFFF;
  --g50:        #FAFBFC;
  --g100:       #F4F5F7;
  --g200:       #E8EAED;
  --g300:       #D1D5DB;
  --g400:       #9CA3AF;
  --g600:       #6B7280;
  --red:        #DC2626;
  --orange:     #D97706;
  --blue:       #2563EB;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,.04), 0 2px 4px rgba(0,0,0,.03);
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--white);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Secure Bar (light) ───────────────────────────────── */
.bar-secure {
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
  color: var(--g600);
  padding: 6px 16px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.bar-secure svg { width: 12px; height: 12px; fill: var(--primary); }

/* ── Top Navigation (light) ───────────────────────────── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--g200);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav a { color: var(--text); text-decoration: none; display: flex; align-items: center; }
.nav svg { width: 24px; height: 24px; fill: var(--g600); }
.nav h1 { color: var(--text); font-size: 16px; font-weight: 600; flex: 1; }
.nav .logo { height: 24px; }
.nav .logo.invert { filter: none; }

/* ── Container ─────────────────────────────────────────── */
.container { padding: 20px 16px 32px; max-width: 420px; margin: 0 auto; }

/* ── Card ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--g200);
  margin-bottom: 14px;
}

/* ── Icon Circles (light) ─────────────────────────────── */
.icon-circle {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-circle svg { width: 20px; height: 20px; }
.icon-circle.brand { background: var(--pale); }
.icon-circle.brand svg { fill: var(--primary); }
.icon-circle.accent { background: #EFF6FF; }
.icon-circle.accent svg { fill: var(--blue); }

/* ── Form Elements ─────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  font-size: 12px; font-weight: 600; color: var(--g600);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px; display: flex; align-items: center; gap: 4px;
}
.form-label .req { color: var(--red); font-size: 14px; }

.input-wrap { position: relative; }
.input-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: var(--g400); pointer-events: none;
}
.input, .select {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--g200);
  border-radius: var(--radius);
  font-family: 'Outfit', sans-serif;
  font-size: 14px; color: var(--text);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%239CA3AF'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--g400);
  box-shadow: none;
}
.form-hint { font-size: 11px; color: var(--g400); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; display: none; }
.form-error.visible { display: block; }

/* ── PIN Dots ──────────────────────────────────────────── */
.pin-row { display: flex; justify-content: center; gap: 14px; margin-bottom: 20px; }
.pin-cell {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--g300);
  display: flex; align-items: center; justify-content: center;
  font-size: 0; color: transparent;
  transition: all .2s ease;
  background: transparent;
}
.pin-cell.filled { border-color: var(--primary); background: var(--primary); transform: scale(1.15); }
.pin-cell.active { border-color: var(--primary); }
.pin-cell.error  { border-color: var(--red); background: var(--red); animation: shake .4s; }

/* ── Virtual Keypad ────────────────────────────────────── */
.keypad { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; max-width: 264px; margin: 0 auto; }
.key {
  height: 50px;
  border-radius: var(--radius);
  border: 1px solid var(--g200);
  background: var(--white);
  font-family: 'Outfit', sans-serif;
  font-size: 20px; font-weight: 600; color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.key:active { background: var(--g100); border-color: var(--g300); transform: scale(.95); }
.key.fn { font-size: 12px; font-weight: 500; color: var(--g600); border-color: transparent; background: transparent; }
.key.fn:active { background: var(--g100); }
.key.fn svg { width: 20px; height: 20px; fill: var(--g600); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  width: 100%; padding: 14px;
  border-radius: var(--radius);
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  margin-top: 8px;
  text-align: center;
  display: block;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:active { opacity: .9; transform: scale(.98); }
.btn-primary:disabled { background: var(--g200); color: var(--g400); cursor: not-allowed; transform: none; opacity: 1; }
.btn-outline { background: var(--white); color: var(--g600); border: 1px solid var(--g200); }
.btn-outline:active { background: var(--g50); }

/* ── Alerts / Notes ────────────────────────────────────── */
.note {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px; border-radius: var(--radius);
  font-size: 11px; line-height: 1.5;
}
.note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.note-secure { background: var(--g50); color: var(--g600); border: 1px solid var(--g200); }
.note-secure svg { fill: var(--primary); }
.note-warn { background: #FFFBEB; color: var(--orange); border: 1px solid #FDE68A; }
.note-warn svg { fill: var(--orange); }
.note-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ── Badges ────────────────────────────────────────────── */
.badge-done {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: var(--g50); border: 1px solid var(--g200); border-radius: var(--radius);
  font-size: 12px; color: var(--primary); font-weight: 600;
}
.badge-done svg { width: 18px; height: 18px; fill: var(--primary); }

.progress-bar { height: 3px; background: var(--g200); border-radius: 2px; margin: 12px 0; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--primary); border-radius: 2px; width: 0; transition: width .2s; }
.progress-text { font-size: 11px; color: var(--g400); text-align: center; }

/* ── Checkbox list ─────────────────────────────────────── */
.chk-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.chk-item { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.chk-item input { display: none; }
.chk-box {
  width: 20px; height: 20px;
  border: 1.5px solid var(--g300); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s;
}
.chk-box svg { width: 14px; height: 14px; fill: var(--white); opacity: 0; transition: opacity .15s; }
.chk-item input:checked + .chk-box { background: var(--primary); border-color: var(--primary); }
.chk-item input:checked + .chk-box svg { opacity: 1; }
.chk-text { font-size: 12.5px; line-height: 1.4; }

/* ── Signature Canvas ──────────────────────────────────── */
.sig-wrap { border: 1px dashed var(--g300); border-radius: var(--radius); padding: 4px; background: var(--white); transition: border-color .2s; }
.sig-wrap.drawing { border-color: var(--primary); border-style: solid; }
.sig-wrap.signed  { border-color: var(--primary); border-style: solid; }
.sig-wrap canvas { display: block; width: 100%; height: 120px; touch-action: none; cursor: crosshair; }

/* ── Overlays / Modals ─────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: var(--white);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 32px;
}
.overlay.visible { display: flex; }
.modal {
  padding: 0; text-align: center;
  max-width: 300px; width: 100%;
  animation: popIn .3s ease;
}
.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal p  { font-size: 14px; color: var(--g600); line-height: 1.5; margin-bottom: 8px; }
.modal .ref { font-size: 11px; color: var(--g400); font-family: monospace; margin-bottom: 20px; line-height: 1.6; }

.modal-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.modal-icon svg { width: 32px; height: 32px; }
.modal-icon.ok  { background: var(--pale); }
.modal-icon.ok svg { fill: var(--primary); }
.modal-icon.err { background: #FEF2F2; }
.modal-icon.err svg { fill: var(--red); }

.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--g200); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}

/* ── Footer ────────────────────────────────────────────── */
.foot {
  text-align: center; margin-top: 20px;
  font-size: 10px; color: var(--g400); line-height: 1.6;
}
.foot svg { width: 12px; height: 12px; fill: var(--g400); vertical-align: -2px; margin-right: 2px; }

/* ── Step bar ──────────────────────────────────────────── */
.steps { display: flex; align-items: center; margin-bottom: 20px; }
.step-dot {
  flex: 1; text-align: center; padding: 8px 2px;
  font-size: 11px; color: var(--g400); transition: color .3s;
}
.step-dot .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--g200); color: var(--g400);
  font-size: 10px; font-weight: 700; margin-bottom: 3px; transition: all .3s;
}
.step-dot .t { display: block; font-size: 10px; line-height: 1.2; }
.step-dot.on .n { background: var(--primary); color: var(--white); }
.step-dot.on    { color: var(--text); }
.step-dot.ok .n { background: var(--pale); color: var(--primary); }
.step-dot.ok    { color: var(--primary); }
.step-line { flex: 0 0 16px; height: 1px; background: var(--g200); transition: background .3s; }
.step-line.ok { background: var(--primary); }

/* ── Utility ───────────────────────────────────────────── */
.hidden { display: none !important; }
.view { display: none; }
.view.active { display: block; }

/* ── WhatsApp Return Button ────────────────────────────── */
.btn-wa-return {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px;
  border-radius: var(--radius);
  border: 1.5px solid #E0E0E0;
  background: var(--white);
  font-family: 'Outfit', sans-serif;
  font-size: 14px; font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-wa-return svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-wa-return:active { background: var(--g50); transform: scale(.98); }

/* ── Animations ────────────────────────────────────────── */
@keyframes shake  { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 50%{transform:translateX(5px)} 75%{transform:translateX(-3px)} }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes popIn  { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .2s ease; }

/* ── Remove spinners from number inputs ────────────────── */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
