/* ==========================================================================
   贷款申请 · 手机端（英文）
   只保留核心申请步骤：额度 → 资料 → 处理 → 报价/提款
   排版按草图：单列卡片、左侧标签右侧输入、底部大按钮
   ========================================================================== */

:root {
    --ink: #111827;
    --ink-2: #374151;
    --muted: #6b7280;
    --muted-2: #9ca3af;
    --line: #e5e7eb;
    --line-soft: #f0f2f5;
    --bg: #f3f5f8;
    --white: #ffffff;
    --brand: #0e6b58;
    --brand-600: #0b5a4a;
    --brand-50: #e9f5f1;
    --danger: #b3261e;
    --warn: #9a6700;
    --warn-bg: #fdf6e7;
    --radius: 14px;
    --radius-sm: 9px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   页面骨架：固定手机宽度，桌面端居中
   -------------------------------------------------------------------------- */
.app {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    padding: 18px 16px 34px;
    min-height: 100vh;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: inherit;
}
.logo__mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: block;
}
.logo__word {
    height: 22px;
    width: auto;
    display: block;
}

.h1 {
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: -.03em;
    font-weight: 800;
}

.h1 .gold { color: var(--brand); }

/* 第一页：最高额度 */
.max-hero {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 50px 0;
    text-align: center;
}
.max-hero + .card { margin-top: 0; }
.max-hero__label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}
.max-hero__value {
    font-size: 40px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.045em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.sub {
    margin-top: 5px;
    font-size: 13px;
    color: var(--muted);
}

.card {
    margin-top: 16px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px 16px 18px;
    box-shadow: 0 6px 20px -18px rgba(17, 24, 39, .25);
}

.card--plain { padding: 20px 16px; }

/* 草图纸的横线：每行之间一条淡线 */
.row {
    display: grid;
    grid-template-columns: 40% 1fr;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line-soft);
}
.row:last-of-type { border-bottom: 0; }
.row--full { display: block; }
.row--full > .label { display: block; margin-bottom: 7px; }
.row--top { align-items: start; }

.label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-2);
    line-height: 1.35;
}
.label .opt { font-weight: 400; color: var(--muted-2); font-size: 11.5px; }

.control { min-width: 0; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.value { font-size: 14.5px; font-weight: 700; color: var(--ink); }

.input,
.select {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 0 11px;
    font-size: 15px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus,
.select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(14, 107, 88, .12);
}
.input.is-invalid,
.select.is-invalid { border-color: var(--danger); background: #fffafa; }

/* 金额 / 电话 的前缀组合 */
.affix {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    height: 42px;
    overflow: hidden;
}
.affix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 107, 88, .12); }
.affix > span {
    padding: 0 9px;
    font-size: 14px;
    font-weight: 650;
    color: var(--muted);
    border-right: 1px solid var(--line-soft);
    height: 100%;
    display: flex;
    align-items: center;
    background: #fafbfc;
}
.affix > input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    padding: 0 10px;
    font-size: 15px;
    background: transparent;
}
.affix.is-invalid { border-color: var(--danger); }

/* 电话行：前缀 + 输入 + 获取验证码 */
.phone-line {
    display: flex;
    gap: 8px;
}
.phone-line .affix { flex: 1; min-width: 0; }

/* 现有贷款 Yes / No */
.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}
.segment {
    position: relative;
    display: block;
}
.segment input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.segment span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink-2);
}
.segment input:checked + span {
    border-color: var(--brand);
    background: var(--brand-50);
    color: var(--brand);
    box-shadow: 0 0 0 2px rgba(14, 107, 88, .1);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
    transition: background .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--brand-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--block { width: 100%; height: 50px; font-size: 16px; margin-top: 16px; }
.btn--sm { height: 42px; padding: 0 12px; font-size: 13px; font-weight: 650; border-radius: var(--radius-sm); flex: 0 0 auto; }
.btn--ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn--ghost:hover { background: #f9fafb; }
.btn__spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 说明 / 错误 */
.hint {
    margin-top: 7px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--muted);
}
.hint--center { text-align: center; }
.hint--warn { color: var(--warn); }
.err {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--danger);
    font-weight: 550;
}
.err:empty { display: none; }

/* 同意条款 */
.check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--ink-2);
}
.check input {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--brand);
}
.check a { text-decoration: underline; }

/* --------------------------------------------------------------------------
   处理页 / 结果页
   -------------------------------------------------------------------------- */
.center-card {
    margin-top: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 34px 22px 28px;
    text-align: center;
}

.spinner-lg {
    width: 62px;
    height: 62px;
    margin: 0 auto 22px;
    border-radius: 50%;
    border: 5px solid var(--brand-50);
    border-top-color: var(--brand);
    animation: spin 1s linear infinite;
}

.count {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 16px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}
.count strong { color: var(--brand); font-size: 15px; }

.done-line {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    font-size: 13px;
    color: var(--brand);
    font-weight: 650;
}

.amount-big {
    margin: 18px 0 6px;
    font-size: 46px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: -.05em;
}

.amount-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.terms {
    margin-top: 20px;
    border-top: 1px solid var(--line-soft);
}
.terms div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 14px;
}
.terms div:last-child { border-bottom: 0; }
.terms span:first-child { color: var(--muted); }
.terms span:last-child { font-weight: 700; color: var(--ink); }

.ref {
    margin-top: 16px;
    font-size: 11.5px;
    color: var(--muted-2);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.result-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-50);
    color: var(--brand);
}

/* --------------------------------------------------------------------------
   底部弹层（风险提示）
   -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(17, 24, 39, .55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
    width: 100%;
    max-width: 430px;
    max-height: 90vh;
    background: #fff;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(24px);
    transition: transform .2s ease;
}
.modal-backdrop.is-open .sheet { transform: translateY(0); }
.sheet__head {
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.sheet__title { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.sheet__sub { margin-top: 3px; font-size: 12px; color: var(--muted); }
.sheet__close {
    margin-left: auto;
    width: 30px; height: 30px;
    border: 0;
    border-radius: 50%;
    background: var(--bg);
    color: var(--muted);
    display: grid;
    place-items: center;
    flex: 0 0 30px;
}
.sheet__body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}
.sheet__foot {
    padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-soft);
}
.sheet__foot .btn { width: 100%; }
.sheet__foot .btn--quiet {
    margin-top: 8px;
    background: transparent;
    color: var(--muted);
    height: 40px;
    font-weight: 600;
}

.upload { margin-bottom: 14px; }
.upload__label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.upload__box {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 54px;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    background: #fbfcfd;
    color: var(--muted);
    font-size: 13px;
}
.upload__box svg { flex: 0 0 auto; color: var(--brand); }
.upload__box input[type="file"] { display: none; }
.upload__box.is-filled { border-style: solid; border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.upload__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload__meta { margin-top: 5px; font-size: 11.5px; color: var(--muted); }

.disclosure {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfd;
    padding: 13px;
    font-size: 12px;
    line-height: 1.65;
    color: #374151;
}
.disclosure p { margin: 0 0 9px; }
.disclosure p:last-child { margin-bottom: 0; }

.summary-mini {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    background: var(--line-soft);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 14px;
}
.summary-mini div { background: #fff; padding: 9px 10px; }
.summary-mini span { display: block; font-size: 10.5px; color: var(--muted); }
.summary-mini strong { display: block; margin-top: 2px; font-size: 14.5px; letter-spacing: -.01em; }

/* 轻提示 */
.toast-host {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 200;
    width: min(92vw, 396px);
    display: grid;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--ink);
    color: #fff;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .5);
}
.toast--error { background: #7f2318; }
.toast--success { background: #0a5245; }

/* 条款弹窗：盖在提款弹层之上 */
#legalModal { z-index: 130; }
#legalModal .legal p { font-size: 13px; line-height: 1.65; }

/* 条款 / 错误页 */
.legal p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.legal p:last-child { margin-bottom: 0; }
.legal h1 { font-size: 21px; letter-spacing: -.02em; }

.error-card { margin-top: 40px; text-align: center; }

/* 蜜罐字段：真人看不见，机器人会填 */
.honey {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

@media (min-width: 480px) {
    .app { padding-top: 34px; }
}
