/* ============================================================================
   HKF eKYC — shared design system
   ----------------------------------------------------------------------------
   One stylesheet for every page in the flow, so the start pages, the capture
   frames and the result pages cannot drift apart.

   Light theme only, deliberately. There is no dark-mode media query anywhere in
   this file — the product is white + blue on tablets, in bright lobbies and on
   phones held up to a document. A dark variant would fight the document-capture
   UI and the ZOLOZ frame it embeds.

   Layout targets iPad first, then phone. Sizes are generous because the
   audience is a mortgage customer holding a tablet, not a developer at a desk.
   ========================================================================= */

:root {
  /* Surfaces */
  --bg: #F5F9FF;
  --surface: #FFFFFF;
  --surface-sunken: #F8FAFF;

  /* Brand */
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-press: #1E40AF;
  --primary-soft: #EFF6FF;
  --secondary: #60A5FA;

  /* Text */
  --text: #0F172A;
  --muted: #64748B;

  /* Lines */
  --border: #E2E8F5;
  --border-strong: #CBD8EE;

  /* Shape */
  --radius: 22px;
  --radius-sm: 16px;
  --radius-pill: 999px;

  /* Elevation — soft, blue-tinted rather than neutral grey */
  --shadow: 0 4px 18px rgba(37, 99, 235, .08), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lift: 0 14px 34px rgba(37, 99, 235, .18), 0 2px 8px rgba(15, 23, 42, .06);

  /* Motion — one curve everywhere so nothing feels inconsistent */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --speed: .18s;

  /* Outcome tones (result pages) */
  --ok-bg: #ECFDF3;   --ok-text: #166534;   --ok-line: #22C55E;
  --pend-bg: #FFFBEB; --pend-text: #92400E; --pend-line: #F59E0B;
  --bad-bg: #FEF2F2;  --bad-text: #991B1B;  --bad-line: #EF4444;
}

* { box-sizing: border-box; }

/* Only the capture-frame pages fill the viewport; the rest scroll normally. */
html { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding: 24px 20px 56px;
}

.wrap { max-width: 560px; margin: 0 auto; }
.hidden { display: none !important; }

/* Centres a pill inside a flex column without stretching it to full width. */
.self-center { align-self: center; }

/* ---------------------------------------------------------------- headings */

h1 {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 4px;
}

.page-sub {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 24px;
}

/* ------------------------------------------------------------------- back */

/* A real button rather than a text link: on a tablet a bare arrow is a small
   target, and this is the only way out of a capture page. */
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px 0 12px;
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: color var(--speed) var(--ease), border-color var(--speed) var(--ease),
              transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.back:hover,
.back:focus-visible {
  color: var(--primary);
  border-color: var(--secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
  outline: none;
}
.back:active { transform: translateY(0); }
.back svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

/* ------------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--pend-bg);
  color: var(--pend-text);
  margin-bottom: 16px;
}
.pill::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ------------------------------------------------------------------ alerts */

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 18px;
  background: var(--bad-bg);
  color: var(--bad-text);
}
.alert.warn { background: var(--pend-bg); color: var(--pend-text); }

/* ------------------------------------------------------------------- forms */

.field { margin-bottom: 20px; }

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

input,
select {
  width: 100%;
  min-height: 56px;
  /* Vertical padding rather than a fixed height: a `select` with `appearance: none`
     does not centre its own text, and a fixed height would clip at larger font sizes. */
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-sunken);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--speed) var(--ease), background-color var(--speed) var(--ease),
              box-shadow var(--speed) var(--ease);
}

/* Chevron for selects, drawn as a background image so the native arrow can go. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 46px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 19px 19px;
}

input:hover,
select:hover { border-color: var(--border-strong); }

input:focus,
select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

input::placeholder { color: #A3AEC2; }

/* ----------------------------------------------------------------- buttons */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 16px 22px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .01em;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--speed) var(--ease), transform var(--speed) var(--ease),
              box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease),
              color var(--speed) var(--ease);
}

.btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, .34);
  outline: none;
}
.btn-primary:active {
  background: var(--primary-press);
  transform: translateY(0) scale(.99);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .24);
}

.btn-secondary {
  color: var(--primary);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--secondary);
  background: var(--primary-soft);
  transform: translateY(-2px);
  outline: none;
}
.btn-secondary:active { transform: translateY(0) scale(.99); }

.btn:disabled {
  opacity: .55;
  cursor: default;
  transform: none !important;
  box-shadow: none;
}

/* Page-level actions sit directly after a card, so they need their own spacing. */
.wrap > .btn { margin-bottom: 12px; }

/* ------------------------------------------------------------------- rows */

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); flex: 0 0 auto; }
.row .v { text-align: right; word-break: break-word; font-weight: 500; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------- result tones */

.verdict { border-left: 5px solid var(--border); }
.verdict.ok      { background: var(--ok-bg);   border-left-color: var(--ok-line); }
.verdict.pending { background: var(--pend-bg); border-left-color: var(--pend-line); }
.verdict.bad     { background: var(--bad-bg);  border-left-color: var(--bad-line); }

.verdict h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.verdict.ok h2      { color: var(--ok-text); }
.verdict.pending h2 { color: var(--pend-text); }
.verdict.bad h2     { color: var(--bad-text); }

.verdict p { margin: 0; font-size: 14px; line-height: 1.45; }
.verdict.ok p      { color: var(--ok-text); }
.verdict.pending p { color: var(--pend-text); }
.verdict.bad p     { color: var(--bad-text); }

.verdict .tick {
  flex: 0 0 auto;
  width: 26px; height: 26px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}
.section-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 12px;
}

ul.notes { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
ul.notes li { margin-bottom: 7px; }

/* ============================================================================
   Landing page
   ========================================================================= */

.landing {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 720px;
  margin: 0 auto;
}

.brand { text-align: center; margin-bottom: 40px; }

.brand-mark {
  width: 66px; height: 66px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: linear-gradient(140deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 10px 26px rgba(37, 99, 235, .30);
}

.brand h1 { font-size: 34px; margin-bottom: 6px; }
.brand .tagline {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 210px;
  padding: 28px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  text-align: center;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}
.choice:hover,
.choice:focus-visible {
  transform: translateY(-4px);
  border-color: var(--secondary);
  box-shadow: var(--shadow-lift);
  outline: none;
}
.choice:active { transform: translateY(-1px) scale(.99); }

.choice-icon {
  width: 76px; height: 76px;
  border-radius: 22px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--speed) var(--ease), color var(--speed) var(--ease);
}
.choice-icon svg { width: 40px; height: 40px; }
.choice:hover .choice-icon,
.choice:focus-visible .choice-icon {
  background: var(--primary);
  color: #fff;
}

.choice-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* One column on a phone, where two 210px cards would be unreadably narrow. */
@media (max-width: 560px) {
  .choices { grid-template-columns: 1fr; }
  .choice {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 118px;
    padding: 22px;
    text-align: left;
    gap: 20px;
  }
  .choice-icon { width: 64px; height: 64px; border-radius: 18px; }
  .choice-icon svg { width: 34px; height: 34px; }
  .brand h1 { font-size: 29px; }
}

/* ============================================================================
   PICS — personal information collection statement

   A long legal document rather than a form, so the shape is a sheet of paper on
   the app's background: one white column, generous leading, and the agreement
   pinned to the bottom of the viewport. Nothing here is fixed-height — the
   statement is several pages long and scrolls the way any document does.
   ========================================================================= */

.pics-page {
  /* Clears the fixed action bar so the last clause is never hidden behind it. */
  padding-bottom: 132px;
}

.pics {
  max-width: 760px;
  margin: 0 auto;
}

.pics-doc {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 46px 50px;
}

/* Traditional Chinese. The app's stack names no CJK face, so the ones the target
   devices actually ship are named explicitly — PingFang on iPad, JhengHei on
   Windows — rather than leaving the glyphs to a browser fallback. */
.pics-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, "PingFang HK", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC",
               "Hiragino Sans CNS", sans-serif;
}

/* Centred, and NOT bold: in the source document only the notice title below it is
   bold, and giving both the same weight flattens that distinction. */
.pics-org {
  margin: 0 0 10px;
  text-align: center;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
}

.pics-title {
  margin: 0 0 34px;
  text-align: center;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.5;
}

/* Each clause is a flex row: the label in its own column, the text in the other,
   so a wrapped line aligns under the text and never under the number. That is the
   hanging indent the document uses, and it is what keeps (xvi) and (1) legible. */
.pics-p {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 15px;
  font-size: 17px;
  line-height: 1.8;
  text-align: justify;
  /* CJK justification; ignored by browsers that do not implement it. */
  text-justify: inter-ideograph;
  overflow-wrap: break-word;
}

.pics-num {
  flex: 0 0 auto;
  min-width: var(--num-w);
  font-variant-numeric: tabular-nums;
}

.pics-txt {
  flex: 1 1 auto;
  min-width: 0;
}

/* Column width per level, sized for the longest label that level actually uses —
   (s) at the top, (xvi) below it, (5) at the bottom — and no wider, so a short
   label like (i) does not leave a hole between the number and its text. */
.lvl-1 { --num-w: 2.5em; }
.lvl-2 { --num-w: 2.9em; margin-left: 2.4em; }
.lvl-3 { --num-w: 2.2em; margin-left: 5.0em; }

/* Unnumbered continuation paragraphs sit at the same left edge as the text of the
   clause they continue, not at the margin. */
.pics-p.cont .pics-txt { margin-left: calc(var(--num-w) + 10px); }

.pics-p.is-bold .pics-txt { font-weight: 700; }

/* The five-line contact block under (n). */
.pics-addr {
  margin: 0 0 3px;
  padding-left: calc(2.5em + 10px);
  font-size: 17px;
  line-height: 1.7;
}

.pics-addr:last-of-type { margin-bottom: 15px; }

/* The agreement, pinned so it stays reachable at any scroll position. */
.pics-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(37, 99, 235, .07);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}

.pics-actions .btn {
  max-width: 760px;
  margin: 0 auto;
  /* A touch target well past the 44px minimum, for a tablet held at arm's length. */
  min-height: 64px;
  font-size: 18px;
}

/* iPad portrait and phones: the sheet loses its margins before the type does. */
@media (max-width: 700px) {
  .pics-doc {
    padding: 30px 22px 36px;
    border-radius: var(--radius-sm);
  }
  .pics-org { font-size: 17px; }
  .pics-title { font-size: 19px; margin-bottom: 26px; }
  .pics-p { font-size: 16px; line-height: 1.75; margin-bottom: 13px; }
  .pics-addr { font-size: 16px; }
  .lvl-2 { margin-left: 1.4em; }
  .lvl-3 { margin-left: 2.8em; }
  .pics-actions .btn { font-size: 17px; }
}

/* ============================================================================
   Capture frame pages (ekyc.html / idr-session.html)
   ========================================================================= */

.frame-page {
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.frame-head {
  flex: 0 0 auto;
  padding: 18px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}
.frame-head h1 { font-size: 17px; margin: 0; }
.frame-head p { font-size: 13px; color: var(--muted); margin: 3px 0 0; }

.frame-stage {
  flex: 1 1 auto;
  position: relative;
  background: var(--surface);
}
.frame-stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  /* 620px is ZOLOZ's documented minimum for auto-scan with sample images. */
  min-height: 620px;
}

.frame-foot {
  flex: 0 0 auto;
  padding: 16px 22px 22px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.frame-foot .note {
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0;
  text-align: center;
}

/* ============================================================================
   Mock SDK stand-in
   ========================================================================= */

.mock-page {
  min-height: 100vh;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.mock-panel { width: 100%; max-width: 440px; }

.mock-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--pend-text);
  background: var(--pend-bg);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  margin-bottom: 20px;
}

.mock-panel h1 { font-size: 22px; margin-bottom: 8px; }
.mock-panel > p { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

.mock-stage {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 3 / 4;
  max-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.mock-frame {
  position: absolute;
  inset: 24px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: border-color var(--speed) var(--ease), color var(--speed) var(--ease),
              background-color var(--speed) var(--ease);
}
.mock-frame.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  border-style: solid;
}

/* Stacked, so the two stand-in actions need their own spacing. */
.mock-panel .btn { margin-bottom: 12px; }

.mock-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
  overflow-wrap: break-word;
}
