/* =============================================================
   MKJP App — UNFPA KB · arcid.space/mkjp
   ============================================================= */

:root {
  --paper:        #F1F7F6;
  --ink:          #1a1814;
  --ink-2:        #4a3f39;
  --ink-3:        #8c7d76;
  --border:       #DDD3C8;
  --border-light: #EDE5DC;
  --accent:       #00B1A9;
  --accent-2:     #C8D400;
  --accent-bg:    rgba(0, 177, 169, 0.10);
  --success:      #2d6a4f;
  --success-bg:   rgba(45, 106, 79, 0.09);
  --card-bg:      #FFFFFF;
  --font-d:       'Inter', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --font-b:       'Inter', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --r:            4px;
  --shadow:       0 2px 16px rgba(26, 24, 20, 0.09);
  --transition:   0.17s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; height: 100%; }
body { font-family: var(--font-b); color: var(--ink); min-height: 100%; line-height: 1.5; }

/* ── Layout ──────────────────────────────────────────────────
   Mobile:  stacked — panel-left shrinks to compact top bar
   Desktop: side-by-side — panel-left is a sticky full-height panel
   ─────────────────────────────────────────────────────────── */

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Left panel (branding) ── */
.panel-left {
  background-color: var(--accent);
  color: #fff;
  padding: 2rem 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
}

.brand-title {
  font-family: var(--font-d);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
}

/* These are hidden on mobile, shown on desktop */
.brand-desc, .brand-divider, .brand-meta, .supported-by { display: none; }

/* ── Kemenkes logo chip + UNFPA credit ── */
.brand-logo {
  background: #fff;
  border-radius: 7px;
  padding: 0.35rem 0.5rem;
  display: inline-block;
  box-shadow: 0 3px 14px rgba(0,0,0,0.14);
}
.brand-logo img { display: block; width: 104px; max-width: 100%; height: auto; }

/* ── Right panel (form content) ── */
.panel-right {
  flex: 1;
  background-color: var(--paper);
  padding: 2rem 1rem 3rem;
  display: flex;
  justify-content: center;
}

.panel-right-inner {
  width: 100%;
  max-width: 460px;
}

/* ── Page lead (step heading inside right panel) ── */
.page-lead {
  margin-bottom: 1.5rem;
}

.page-step {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.page-title {
  font-family: var(--font-d);
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.page-sub {
  font-size: 0.875rem;
  color: var(--ink-3);
  line-height: 1.5;
}

/* ── Card ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--r);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
}

/* ── Field ── */
.field { margin-bottom: 1.5rem; }
.field:last-of-type { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.45rem;
}

.field-input {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 0.5rem 0;
  font-size: 1.05rem;
  font-family: var(--font-b);
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.field-input:focus { border-bottom-color: var(--accent); }
.field-input::placeholder { color: var(--ink-3); opacity: 1; }

.field-hint {
  font-size: 0.76rem;
  color: var(--ink-3);
  margin-top: 0.4rem;
}

.field-error {
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: 0.4rem;
  font-weight: 500;
}
.field-error[hidden] { display: none; }

.pkm-warn {
  margin-top: 0.4rem;
  padding: 0.55rem 0.75rem;
  background: rgba(180, 120, 0, 0.08);
  border: 1px solid rgba(180, 120, 0, 0.28);
  border-radius: var(--r);
  color: #7a5000;
  font-size: 0.78rem;
  line-height: 1.45;
}
.pkm-warn[hidden] { display: none; }

.captcha-wrap {
  margin-bottom: 0.75rem;
}
.captcha-wrap altcha-widget {
  width: 100%;
}

/* ── Numeric field row ── */
.field-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border-light);
}
.field-row:last-child { border-bottom: none; padding-bottom: 0; }

.field-row-body { flex: 1; min-width: 0; }

.field-row-label {
  font-size: 0.875rem;
  color: var(--ink);
  line-height: 1.4;
}

.field-row-desc {
  font-size: 0.75rem;
  color: var(--ink-3);
  margin-top: 0.15rem;
}

.field-row-input {
  width: 68px;
  flex-shrink: 0;
  border: none;
  border-bottom: 1.5px solid var(--border);
  background: transparent;
  padding: 0.35rem 0;
  font-size: 1rem;
  font-family: var(--font-b);
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  outline: none;
  transition: border-color var(--transition);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
.field-row-input:focus { border-bottom-color: var(--accent); }
.field-row-input.error { border-bottom-color: var(--accent); color: var(--accent); }

/* ── OTP grid ── */
.otp-grid {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.75rem 0 1.5rem;
}

.otp-input {
  width: 44px;
  height: 54px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--card-bg);
  font-size: 1.5rem;
  font-family: var(--font-b);
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  outline: none;
  caret-color: var(--accent);
  transition: border-color var(--transition), background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.otp-input:focus { border-color: var(--accent); background: #fff; }
.otp-input.filled { border-color: var(--ink-2); background: #fff; }

/* ── Button ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 0.875rem;
  font-family: var(--font-b);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  margin-top: 1.25rem;
}
.btn:hover:not(:disabled) { background: #d95a1e; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: rgba(255,255,255,0.9);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
.btn-spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PKM identity card ── */
.pkm-card {
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
}
.pkm-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.pkm-card-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.2rem 0.75rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  align-items: baseline;
}
.pkm-card-row:last-child { margin-bottom: 0; }
.pkm-card-key { color: var(--ink-3); font-size: 0.78rem; }
.pkm-card-val { font-weight: 600; color: var(--ink); word-break: break-word; }

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.75rem 0 0.75rem;
  border-bottom: 1.5px solid var(--ink);
}
.section-header-title {
  font-family: var(--font-d);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.section-header-count {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ── Success card ── */
.success-card { text-align: center; padding: 2.75rem 1.5rem 2rem; }
.success-card[hidden] { display: none; }
.success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.success-icon svg {
  width: 28px; height: 28px;
  stroke: var(--success); fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}
.success-title {
  font-family: var(--font-d);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.success-sub { font-size: 0.875rem; color: var(--ink-3); line-height: 1.55; margin-bottom: 0.4rem; }

.success-time {
  font-size: 0.75rem;
  color: var(--ink-3);
  margin-top: 0.25rem;
}

/* ── Soft subtotal warning ── */
.field-warning {
  font-size: 0.78rem;
  color: #92400e;
  background: rgba(146, 64, 14, 0.07);
  border-left: 2px solid #d97706;
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0 0.25rem;
  border-radius: 0 var(--r) var(--r) 0;
  line-height: 1.45;
}
.field-warning[hidden] { display: none; }

/* ── OTP resend ── */
.otp-resend { text-align: center; font-size: 0.82rem; color: var(--ink-3); margin-top: 1rem; }
.resend-btn {
  background: none; border: none; padding: 0;
  font: inherit; font-size: inherit;
  color: var(--accent); text-decoration: underline; cursor: pointer;
  transition: opacity var(--transition);
}
.resend-btn:disabled { color: var(--ink-3); text-decoration: none; cursor: default; }

/* ── Form actions ── */
.form-actions { padding-top: 1.5rem; border-top: 1px solid var(--border-light); margin-top: 1rem; }
.form-error-global {
  font-size: 0.82rem; color: var(--accent);
  text-align: center; margin-bottom: 0.75rem; font-weight: 500;
}
.form-error-global[hidden] { display: none; }

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-3);
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: color var(--transition);
}
.back-link:hover { color: var(--ink); text-decoration: none; }

/* ── Page footer ── */
.page-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-3);
  margin-top: 1.5rem;
  letter-spacing: 0.02em;
}

/* ── Phone display ── */
.phone-display { font-weight: 600; color: var(--ink); }

/* ── Select input ── */
select.field-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  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='none' stroke='%238c7d76' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.25rem center;
  padding-right: 1.5rem;
}
select.field-input:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Mode toggle (login ↔ register) ── */
.mode-toggle {
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-3);
  margin-top: 1.25rem;
}
.mode-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.mode-toggle-btn:hover { opacity: 0.8; }

/* ── Password show/hide wrapper ── */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrap .field-input { flex: 1; padding-right: 2rem; }
.pw-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.15rem;
  cursor: pointer;
  color: var(--ink-3);
  line-height: 0;
  transition: color var(--transition);
}
.pw-toggle:hover { color: var(--ink); }
.pw-toggle svg { width: 18px; height: 18px; display: block; }

/* ═══════════════════════════════════════════════════════════
   DESKTOP — split panel layout (≥ 720px)
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 720px) {

  .layout {
    flex-direction: row;
    min-height: 100vh;
  }

  /* Left: sticky orange brand panel */
  .panel-left {
    flex: 0 0 300px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 3rem 2.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
  }

  .brand-badge { margin-bottom: 2.25rem; }

  .brand-title {
    font-size: clamp(1.75rem, 2.5vw, 2.2rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
  }

  /* Shown only on desktop */
  .brand-desc {
    display: block;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.6;
    margin-bottom: auto;
  }

  .brand-divider {
    display: block;
    width: 42px;
    height: 2px;
    background: var(--accent-2);
    margin: 2rem 0 1.25rem;
  }

  .brand-meta {
    display: block;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    line-height: 1.8;
    letter-spacing: 0.02em;
  }

  .brand-logo { margin-bottom: 1.9rem; padding: 0.55rem 0.75rem; }
  .brand-logo img { width: 188px; }

  .supported-by {
    display: block;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.02em;
  }
  .supported-by strong { font-weight: 800; letter-spacing: 0.05em; }

  /* Right: scrollable content area */
  .panel-right {
    flex: 1;
    padding: 3.5rem 3rem;
    align-items: flex-start;
  }

  .panel-right-inner {
    max-width: 520px;
    width: 100%;
  }

  .card { padding: 2.25rem 2rem; }

  .otp-input { width: 52px; height: 62px; font-size: 1.6rem; }
  .otp-grid { gap: 0.625rem; }
}

/* Very wide screens: slightly wider panel */
@media (min-width: 1100px) {
  .panel-left { flex: 0 0 360px; padding: 3.5rem 3rem; }
  .brand-title { font-size: 2.4rem; }
}

/* ── Loading state ── */
.loading-state {
  padding: 3rem 0;
  font-family: var(--font-d);
  font-size: 1.05rem;
  color: var(--ink-3);
}

/* ── Logout link ── */
.logout-link {
  background: none; border: none; padding: 0;
  color: var(--ink-3); font-size: 0.78rem;
  font-family: var(--font-b); cursor: pointer;
  text-decoration: underline;
  transition: color var(--transition);
}
.logout-link:hover { color: var(--ink); }

/* ── Page lead row (title + logout) ── */
.page-lead-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ── Review page ── */
.review-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--paper);
  background-image: radial-gradient(circle, rgba(26,24,20,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

.review-topbar {
  background: var(--accent);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.review-topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.review-topbar-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
}

.review-topbar-title {
  font-family: var(--font-d);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.review-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  width: 100%;
}

.review-page-header {
  margin-bottom: 1.75rem;
}

.review-page-title {
  font-family: var(--font-d);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.review-summary {
  font-size: 0.875rem;
  color: var(--ink-3);
}

.review-summary strong { color: var(--ink); font-weight: 600; }

/* ── Language toggle ── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: rgba(0,0,0,0.12);
  border-radius: 99px;
  padding: 2px;
}
.lang-btn {
  background: none;
  border: none;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  cursor: pointer;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-b);
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}
.lang-btn--active {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
/* Light background variant (e.g. inside right panel) */
.lang-toggle--light { background: rgba(26,24,20,0.07); }
.lang-toggle--light .lang-btn { color: var(--ink-3); }
.lang-toggle--light .lang-btn--active { background: rgba(26,24,20,0.12); color: var(--ink); }

/* hide-captcha */ .captcha-wrap{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
