/* 3DS overlay — scoped to .tds-overlay */
:root {
  --brand: #1a1f71;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --field-bg: #ffffff;
  --ok: #15803d;
  --danger: #b91c1c;
}
.n-mastercard { --brand: #d1051d; }
.n-visa       { --brand: #1a1f71; }
.n-amex       { --brand: #006fcf; }
.n-discover   { --brand: #e2660f; }
.n-jcb        { --brand: #0b4ea2; }
/* ---------------- 模态弹窗 ---------------- */
.tds-modal {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 44px rgba(17, 24, 39, 0.14);
  overflow: hidden;
}

/* 顶部安全条 */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #f8f9fb;
  border-bottom: 1px solid var(--line);
}
.bar .sec {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--ink-2);
  text-transform: none;
}
.bar .cancel {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
.bar .cancel:hover { color: var(--ink); }

/* Logo 行 */
.brands {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.issuer {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.issuer .ic {
  width: 34px; height: 34px;
  flex: none;
  color: var(--ink);
}
.issuer .ic svg { width: 100%; height: 100%; display: block; }
.issuer .nm { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.issuer .nm small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); margin-top: 2px; }

.network { text-align: right; flex: none; }
.network .lg { height: 26px; display: inline-block; }
.network .lg svg, .network .lg img { height: 100%; width: auto; display: block; }
.network .prog { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; letter-spacing: .2px; font-weight: 600; }

/* 主体 */
.body { padding: 22px; }

.title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.2px;
  margin: 0 0 8px;
  color: var(--ink);
}
.desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 20px;
}
.desc b { color: var(--ink); font-weight: 700; }

/* 输入 */
.field { margin-bottom: 8px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  padding: 13px 14px;
  font-size: 17px;
  letter-spacing: 3px;
  font-family: inherit;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { letter-spacing: normal; color: #9ca3af; font-size: 15px; }
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
.field.error input { border-color: var(--danger); }

.err {
  display: none;
  font-size: 12.5px;
  color: var(--danger);
  margin: 8px 0 0;
}
.err.show { display: block; }

/* 按钮 */
.btn {
  width: 100%;
  border: none;
  border-radius: 5px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: filter .15s, opacity .15s;
  margin-top: 18px;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary.is-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  cursor: wait;
}
.btn-primary.is-loading .pay-spin {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.btn-outline {
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
}
.btn-outline:hover { background: #f9fafb; color: var(--ink); }

/* 重新发送 */
.resend {
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 16px;
}
.resend button {
  background: none; border: none; padding: 0;
  font-size: 13px; font-weight: 700; font-family: inherit;
  color: var(--brand); cursor: pointer;
}
.resend button:disabled { color: var(--ink-3); cursor: default; font-weight: 600; }

/* 底部 更多信息（可展开） */
.more {
  border-top: 1px solid var(--line);
  margin-top: 22px;
}
.more summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 15px 22px;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
  user-select: none;
}
.more summary::-webkit-details-marker { display: none; }
.more summary .chev { margin-left: auto; transition: transform .2s; color: var(--ink-3); }
.more[open] summary .chev { transform: rotate(180deg); }
.more .detail { padding: 0 22px 18px; }
.more .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.more .row:last-child { border-bottom: none; }
.more .row .k { color: var(--ink-3); }
.more .row .v { color: var(--ink); font-weight: 600; text-align: right; }

.legal {
  padding: 0 22px 18px;
  font-size: 11px;
  line-height: 1.55;
  color: #9ca3af;
}

/* ---------------- App 确认（等待）态 ---------------- */
.wait {
  text-align: center;
  padding: 8px 0 4px;
}
.ring {
  width: 46px; height: 46px;
  margin: 6px auto 16px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wait .st {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}
.wait .sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0;
}
.expiry {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 18px;
}
.expiry b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 700; }

/* App hand-off challenge */
.app-body{padding-top:24px}
.app-intro{
  margin:0;
  color:var(--ink);
  font-size:17px;
  line-height:1.55;
  font-weight:500;
}
.phone-icon{
  width:44px;
  height:66px;
  margin:24px auto;
  color:var(--brand);
}
.phone-icon svg{display:block;width:100%;height:100%}
.app-continue{border-radius:999px;margin-top:0}
.app-actions{
  display:flex;
  justify-content:center;
  margin-top:22px;
}
.app-actions button{
  padding:0;
  border:0;
  background:none;
  color:var(--brand);
  font:inherit;
  font-size:12.5px;
  font-weight:600;
  line-height:1.35;
  text-decoration:underline;
  text-underline-offset:3px;
  cursor:pointer;
}
.app-intro--incomplete {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.5;
}
.app-wait-ring {
  width: 42px;
  height: 42px;
  margin: 18px auto 16px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
.app-wait-text {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
}

/* ---------------- 结果态 ---------------- */
.result { text-align: center; padding: 14px 0 6px; }
.result .ico {
  width: 60px; height: 60px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--ok) 12%, #fff);
}
.result.fail .ico { background: color-mix(in srgb, var(--danger) 12%, #fff); }
.result h3 { font-size: 17px; margin: 0 0 6px; color: var(--ink); }
.result p { font-size: 13.5px; color: var(--ink-3); margin: 0; line-height: 1.5; }
/* ---------------- 3DS 遮罩弹窗 ---------------- */
.tds-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  z-index: 120;
  animation: fade .18s ease;
  overflow-y: auto;
}
.tds-overlay[hidden] { display: none; }
.tds-overlay .tds-modal { animation: pop .2s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* 隐藏的发卡行名（无匹配时） */
.issuer .nm[hidden] { display: none; }

/* ============================================================
   五套独立设计骨架：头部结构 / 对齐 / 输入框形态各不相同，
   而非同一模板换色。主题类挂在 .tds-modal 上（收银弹窗 + 独立页）。
   ============================================================ */

/* ——— VISA Secure：经典分栏头部 + 下划线输入 + 深蓝 ——— */
.tds-modal.n-visa { border-top: 3px solid #1a1f71; }
.n-visa .prog { color: #1a1f71; text-transform: uppercase; letter-spacing: 1px; }
.n-visa .title {
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: #1a1f71;
  font-size: 20px;
  letter-spacing: -.2px;
}
.n-visa .field label { color: #1a1f71; }
.n-visa .field input {
  border: 0;
  border-bottom: 2px solid var(--line-2);
  border-radius: 0;
  padding: 10px 2px;
  background: transparent;
  letter-spacing: 5px;
}
.n-visa .field input:focus { border-bottom-color: #1a1f71; box-shadow: none; }
.n-visa .btn-primary { border-radius: 6px; letter-spacing: .2px; }

/* ——— Mastercard ID Check：品牌前置 + 发卡行名置于品牌下方 ——— */
.tds-modal.n-mastercard { border-radius: 6px; }
.n-mastercard .brands {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  background: #f6f6f6;
  padding: 16px 22px 14px;
}
.n-mastercard .network { order: -1; text-align: left; width: 100%; }
.n-mastercard .network .lg { height: 30px; }
.n-mastercard .prog { color: #cc0000; font-weight: 700; text-align: left; margin-top: 4px; }
.n-mastercard .issuer {
  width: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e4e4e4;
}
.n-mastercard .issuer .ic { display: none; }
.n-mastercard .issuer .nm {
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 600;
  line-height: 1.35;
  max-width: 100%;
}
.n-mastercard .title {
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.06;
  color: #141413;
}
.n-mastercard .desc { font-size: 14.5px; }
.n-mastercard .field input { border-radius: 4px; border-width: 2px; padding: 15px 14px; }
.n-mastercard .field input:focus {
  border-color: #cc0000;
  box-shadow: 0 0 0 3px rgba(204, 0, 0, .14);
}
.n-mastercard .btn-primary { background: #141413; border-radius: 4px; }
.n-mastercard .btn-primary:hover { background: #000; filter: none; }
.n-mastercard .resend button { color: #cc0000; }
.n-mastercard .ring { border-top-color: #141413; }

/* ——— American Express SafeKey：蓝色横幅 + 居中品牌带 + 衬线居中 + 方形居中输入 ——— */
.n-amex .bar { background: #006fcf; border-bottom-color: #006fcf; }
.n-amex .bar .sec, .n-amex .bar .cancel { color: #fff; }
.n-amex .bar .cancel:hover { color: #d6ecff; }
.n-amex .brands {
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  background: #eaf4ff;
  border-bottom-color: #cfe6fb;
  padding: 18px 22px;
}
.n-amex .issuer { justify-content: center; }
.n-amex .issuer .ic { display: none; }
.n-amex .issuer .nm { text-align: center; font-size: 13px; font-weight: 600; color: #0b3d73; }
.n-amex .network { text-align: center; }
.n-amex .network .lg { height: 28px; }
.n-amex .prog { text-transform: uppercase; letter-spacing: 1px; color: #006fcf; margin-top: 6px; }
.n-amex .body, .n-amex .app-body { text-align: center; }
.n-amex .title {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0;
}
.n-amex .field label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11.5px;
  text-align: center;
}
.n-amex .field input { border-radius: 2px; text-align: center; border-width: 1.5px; }
.n-amex .btn-primary {
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 14px;
}
.n-amex .app-intro { text-align: center; }

/* ——— Discover ProtectBuy：暖色圆形头像分栏 + 大圆角胶囊输入 ——— */
.tds-modal.n-discover { border-radius: 18px; }
.n-discover .bar { background: #fff7f0; border-bottom-color: #fde4d0; }
.n-discover .brands { background: linear-gradient(#fff7f0, #fff); }
.n-discover .issuer .ic {
  background: #ffe6d2;
  color: #c9560c;
  border-radius: 50%;
  padding: 7px;
  width: 40px; height: 40px;
}
.n-discover .issuer .nm { font-size: 14px; }
.n-discover .title {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 800;
  font-size: 21px;
  color: #c9560c;
}
.n-discover .desc { line-height: 1.6; font-size: 14.5px; }
.n-discover .field input {
  border-radius: 999px;
  padding: 14px 20px;
}
.n-discover .field input:focus {
  border-color: #e2660f;
  box-shadow: 0 0 0 3px rgba(226, 102, 15, .16);
}
.n-discover .btn-primary { border-radius: 999px; font-size: 15.5px; padding: 15px; }
.n-discover .resend button { color: #e2660f; }
.n-discover .app-continue { border-radius: 999px; }
.n-discover .legal .seal {
  border-color: #fde4d0;
  background: #fff7f0;
  color: #b45309;
}

/* ——— JCB J/Secure：三色顶条 + 极简居中小 logo + 居中宽字距输入 ——— */
.n-jcb::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg,
    #0b4ea2 0 33.33%, #be1833 33.33% 66.66%, #007b40 66.66% 100%);
}
.n-jcb .brands {
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  padding: 20px 22px 16px;
}
.n-jcb .issuer { justify-content: center; }
.n-jcb .issuer .ic { display: none; }
.n-jcb .issuer .nm { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.n-jcb .network { text-align: center; }
.n-jcb .network .lg { height: 26px; }
.n-jcb .prog { color: #0b4ea2; margin-top: 5px; letter-spacing: .4px; }
.n-jcb .body { padding: 26px 24px 24px; text-align: center; }
.n-jcb .app-body { text-align: center; }
.n-jcb .title {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: .4px;
  color: #0b4ea2;
}
.n-jcb .desc { color: var(--ink-3); font-size: 13.5px; }
.n-jcb .field label {
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 11px;
  text-align: center;
}
.n-jcb .field input {
  border-radius: 9px;
  text-align: center;
  letter-spacing: 6px;
}
.n-jcb .btn-primary { border-radius: 9px; }
.n-jcb .app-intro { text-align: center; }

/* ============================================================
   点击 Pay 后的品牌加载态 — 斜切进度条 + 静态 Logo（参考 Visa Secure）
   ============================================================ */
.tds-loader {
  padding: 56px 40px 48px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.tds-loader--progress { gap: 22px; }
.tds-loader .ldr-bar {
  width: min(72%, 280px);
  height: 26px;
  background: #eceef3;
  transform: skewX(-20deg);
  overflow: hidden;
  position: relative;
  flex: none;
}
.tds-loader .ldr-bar__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  animation: ldrBarProgress 2.4s ease-in-out infinite;
}
@keyframes ldrBarProgress {
  0% { width: 0%; }
  45% { width: 68%; }
  75% { width: 88%; }
  100% { width: 100%; }
}
.ldr-bar[data-net="visa"] .ldr-bar__fill,
.n-visa .ldr-bar__fill { background: linear-gradient(90deg, #4b3fd6, #7b6cf6); }
.ldr-bar[data-net="mastercard"] .ldr-bar__fill,
.n-mastercard .ldr-bar__fill { background: linear-gradient(90deg, #eb001b 0%, #eb001b 48%, #ff9f00 48%, #ff9f00 100%); }
.ldr-bar[data-net="amex"] .ldr-bar__fill,
.n-amex .ldr-bar__fill { background: #006fcf; }
.ldr-bar[data-net="discover"] .ldr-bar__fill,
.n-discover .ldr-bar__fill { background: #e2660f; }
.ldr-bar[data-net="jcb"] .ldr-bar__fill,
.n-jcb .ldr-bar__fill { background: linear-gradient(90deg, #0b4ea2, #be1833, #007b40); }
.ldr-bar[data-net=""] .ldr-bar__fill,
.tds-loader .ldr-bar:not([data-net]) .ldr-bar__fill { background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.tds-loader .ldr-mark {
  height: 32px;
  width: auto;
  display: block;
  animation: none;
}
.tds-loader .ldr-note { margin: 0; font-size: 12px; color: var(--ink-3); letter-spacing: .2px; }

/* build version badge */
.ver{margin-top:10px;text-align:center;font-size:11px;color:#94a3b8;letter-spacing:.2px}

/* EMV 3-D Secure security indicator */
.bar .sec svg{flex:none}
.legal p{margin:0}
.legal .seal{
  display:flex;
  align-items:center;
  gap:6px;
  width:max-content;
  margin-top:12px;
  padding:5px 9px 5px 6px;
  border:1px solid #e5e7eb;
  border-radius:999px;
  background:#f8fafc;
  color:#64748b;
}
.legal .seal img{width:18px;height:18px;flex:none}
.legal .seal strong{font-size:10.5px;font-weight:600;letter-spacing:.15px}