:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --border: #e2e6ea;
  --border-focus: #0969da;
  --text: #1f2328;
  --text-muted: #656d76;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-glow: rgba(9, 105, 218, 0.12);
  --success: #1a7f37;
  --success-bg: #dafbe1;
  --danger: #cf222e;
  --danger-bg: #ffebe9;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(31, 35, 40, 0.04), 0 1px 2px rgba(31, 35, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(31, 35, 40, 0.06), 0 1px 4px rgba(31, 35, 40, 0.04);
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --border: #30363d;
  --border-focus: #58a6ff;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --success: #3fb950;
  --success-bg: rgba(63, 185, 80, 0.1);
  --danger: #f85149;
  --danger-bg: rgba(248, 81, 73, 0.1);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
}

.header {
  margin-bottom: 28px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
}

.header .badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 16px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.field-help { margin-top: 5px; font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.proxy-controls { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.proxy-controls .field { margin-bottom: 16px; }
.proxy-source-row { flex: 0 0 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode2-paypal-switch { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.mode2-paypal-switch span { flex: 1; min-width: 0; }
.mode2-paypal-switch strong, .mode2-paypal-switch small { display: block; }
.mode2-paypal-switch strong { font-size: 14px; color: var(--text); }
.mode2-paypal-switch small { margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.mode2-paypal-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode2-paypal-switch i { position: relative; width: 42px; height: 24px; flex: 0 0 42px; border-radius: 999px; background: var(--border); transition: background .18s ease; }
.mode2-paypal-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease; }
.mode2-paypal-switch input:checked + i { background: var(--accent); }
.mode2-paypal-switch input:checked + i::after { transform: translateX(18px); }
.mode2-paypal-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 8px; }
.mode2-paypal-input { grid-column: 1 / -1; display: block; padding: 12px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-glow); }
.mode2-paypal-options[hidden], .mode2-paypal-input[hidden] { display: none; }
.mode2-paypal-input .field { min-width: 0; margin-bottom: 0; }
.mode2-paypal-code-controls { display: grid; grid-template-columns: minmax(0, 1fr) 136px; align-items: stretch; gap: 10px; }
.mode2-paypal-code-controls input, .mode2-paypal-code-controls button { height: 40px; }
.mode2-paypal-code-controls button { width: 136px; padding-inline: 12px; white-space: nowrap; }
.proxy-pool-field { flex: 0 0 150px; min-width: 140px; }
.proxy-region-field { flex: 0 0 150px; min-width: 140px; }
#mode5ProxyModeField { flex-basis: 190px; }
#mode5ProxyRegionField { flex-basis: 170px; }

textarea, input, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  height: 200px;
  resize: none;
  font-family: "SF Mono", "Cascadia Code", "Menlo", monospace;
  font-size: 13px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.token-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  min-height: 34px;
}
.token-refresh {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.token-refresh:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); background: var(--surface-2); }
.token-refresh[hidden] { display: none; }
.token-refresh.loading svg { animation: spin 0.75s linear infinite; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--text-muted) var(--surface-2); }

textarea:focus, input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[readonly] { background: var(--surface-2); color: var(--text-muted); cursor: default; }

.input-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.input-label-row label { margin-bottom: 0; }
.mode-hint { font-size: 12px; font-weight: 600; color: var(--accent); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23656d76' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mode-config-grid { grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, .8fr)) minmax(0, 1fr); }
.grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }


.mode11-card { margin: 16px 0 8px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.mode11-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.mode11-head h3 { margin: 0; font-size: 15px; line-height: 1.35; color: var(--text); }
.mode11-head p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.mode11-route { flex: 0 0 auto; max-width: 45%; padding: 5px 9px; border: 1px solid rgba(9,105,218,0.24); border-radius: 999px; background: var(--accent-glow); color: var(--accent); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode11-inline-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; align-items: start; }
.mode11-inline-grid .field { margin-bottom: 0; }
@media (max-width: 720px) { .mode11-inline-grid { grid-template-columns: 1fr; } }
.mode11-section { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.mode11-section + .mode11-section, .mode11-otp-panel { margin-top: 12px; }
.mode11-section-title { margin-bottom: 12px; font-size: 13px; font-weight: 800; color: var(--text); letter-spacing: .2px; }
.mode11-grid { display: grid; gap: 12px; }
.mode11-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode11-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode11-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mode11-card-grid { grid-template-columns: minmax(220px, 1.7fr) minmax(140px, .9fr) minmax(95px, .55fr) minmax(160px, 1fr); align-items: end; }
.mode11-grid > * { min-width: 0; }
.mode11-span-2 { grid-column: span 2; }
.mode11-token-note { margin: 8px 0 12px; padding: 8px 10px; border: 1px dashed rgba(9,105,218,0.32); border-radius: 8px; color: var(--text-muted); background: var(--accent-glow); font-size: 12px; line-height: 1.45; }
.mode11-method-panel { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.mode11-method-panel[hidden] { display: none; }
.mode11-panel-title { margin-bottom: 10px; font-size: 12px; font-weight: 800; color: var(--accent); }
.mode11-help-block { align-self: end; }
.mode11-access-token { min-height: 86px; height: 86px; resize: vertical; }
.mode11-expiry-group { display: grid; grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr); align-items: center; gap: 7px; }
.mode11-expiry-group span { color: var(--text-muted); text-align: center; font-weight: 700; }
.mode11-expiry-group input { text-align: center; }
.mode11-otp-panel { display: block; padding: 12px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-glow); }
.mode11-otp-panel[hidden] { display: none; }
.mode11-otp-panel .field { margin-bottom: 0; }

.mode11-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mode11-section-heading .mode11-section-title { margin-bottom: 3px; }
.mode11-section-desc { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.mode11-login-grid { margin-bottom: 12px; }
.mode11-method-panel { padding: 14px; border-radius: 12px; background: linear-gradient(180deg, rgba(9,105,218,0.055), var(--surface-2)); }
[data-theme="dark"] .mode11-method-panel { background: linear-gradient(180deg, rgba(88,166,255,0.08), var(--surface-2)); }
.mode11-method-panel .field:last-child { margin-bottom: 0; }
.mode11-panel-title { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; background: var(--accent-glow); }
.mode11-compact-textarea { height: 68px; min-height: 68px; resize: vertical; font-family: "SF Mono","Cascadia Code","Menlo",monospace; white-space: nowrap; overflow-x: auto; }
.mode11-manual-card { display: grid; grid-template-columns: minmax(210px, .9fr) minmax(280px, 1.1fr); gap: 14px; align-items: end; }
.mode11-manual-copy, .mode11-otp-copy { display: grid; gap: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.mode11-manual-copy strong, .mode11-otp-copy strong { color: var(--text); font-size: 14px; }
.mode11-pill, .mode11-secure-pill { display: inline-flex; align-items: center; width: max-content; padding: 2px 8px; border-radius: 999px; background: var(--accent-glow); color: var(--accent); font-size: 12px; font-weight: 800; }
.mode11-bank-section { overflow: hidden; }
.mode11-secure-pill { flex: 0 0 auto; }
.mode11-payment-card { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: radial-gradient(circle at top left, var(--accent-glow), transparent 36%), var(--surface-2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.mode11-payment-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; color: var(--text-muted); font-size: 12px; font-weight: 800; letter-spacing: .2px; text-transform: uppercase; }
.mode11-card-chip { width: 28px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, #f7d774, #c89b2b); box-shadow: inset 0 -1px 0 rgba(0,0,0,.18); }
.mode11-payment-grid { display: grid; grid-template-columns: minmax(240px, 2fr) minmax(150px, 1fr) 116px 150px; gap: 12px; align-items: end; }
.mode11-payment-grid > .field { margin-bottom: 0; }
.mode11-card-number { grid-column: 1 / span 2; }
.mode11-card-number input { font-family: "SF Mono","Cascadia Code","Menlo",monospace; letter-spacing: .08em; }
.mode11-cardholder { grid-column: 3 / span 2; }
.mode11-expiry-field { grid-column: 1; width: 176px; max-width: 176px; min-width: 150px; }
.mode11-cvc-field { grid-column: 2; width: 118px; max-width: 118px; }
.mode11-expiry-group { height: 42px; grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.mode11-expiry-group:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.mode11-expiry-group input { height: 40px; border: 0; background: transparent; box-shadow: none; text-align: center; padding: 0 6px; }
.mode11-expiry-group input:focus { border-color: transparent; box-shadow: none; }
.mode11-expiry-group span { align-self: center; color: var(--text-muted); font-weight: 800; }
.mode11-billing-country { grid-column: 3; width: 150px; max-width: 150px; }
.mode11-otp-panel { padding: 14px; border-radius: 14px; background: linear-gradient(135deg, var(--accent-glow), var(--surface)); }
.mode11-otp-card { display: grid; grid-template-columns: minmax(210px, .85fr) minmax(280px, 1.15fr); gap: 14px; align-items: end; }
.mode11-otp-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.mode11-otp-input { text-align: center; letter-spacing: .28em; font-family: "SF Mono","Cascadia Code","Menlo",monospace; font-weight: 800; }


.token-meta { flex: 1 1 auto; padding-top: 2px; font-size: 12px; color: var(--text-muted); min-height: 17px; line-height: 1.45; word-break: break-word; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.toggle-advanced { display: inline-flex; align-items: center; gap: 5px; padding: 6px 0; font-size: 13px; color: var(--text-muted); cursor: pointer; border: none; background: none; transition: color 0.15s; }
.toggle-advanced:hover { color: var(--accent); }
.toggle-advanced svg { transition: transform 0.2s; }
.toggle-advanced.open svg { transform: rotate(90deg); }

.advanced-panel { display: none; margin-top: 12px; }
.advanced-panel.show { display: block; }

.actions { display: flex; gap: 8px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

button, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; border: none; border-radius: var(--radius-sm); padding: 0 16px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); font-weight: 600; }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15652c; }
button:disabled, a.btn.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.5s linear infinite; }
.spinner.active { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar { display: none; height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 14px; overflow: hidden; }
.progress-bar.active { display: block; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; width: 0%; transition: width 0.4s ease; }
.progress-text { display: none; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.progress-text.active { display: block; }

.mode7-input-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin-bottom: 14px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.mode7-input-tabs[hidden] { display: none; }
.mode7-input-tab { height: 36px; border: 0; border-radius: 5px; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: color 0.15s, background 0.15s, box-shadow 0.15s; }
.mode7-input-tab:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.mode7-input-tab.active { color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border), var(--shadow); }
.mode7-input-tab:disabled { cursor: not-allowed; opacity: 0.65; }
.mode7-batch-panel { margin: 0 0 18px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.mode7-batch-panel[hidden] { display: none; }
.mode7-batch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.mode7-batch-title { font-size: 14px; font-weight: 700; color: var(--text); }
.mode7-batch-help { margin-top: 3px; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.mode7-batch-count { flex: 0 0 auto; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--accent); }
.mode7-batch-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mode7-file-button { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; }
.mode7-file-button:hover { border-color: var(--accent); }
.mode7-concurrency-label { margin-left: 4px; font-size: 12px; color: var(--text-muted); }
input.mode7-concurrency { width: 70px; height: 38px; }
.mode7-batch-controls button { height: 38px; }
.mode11-batch-cardpool { margin-top: 12px; }
.mode11-batch-cardpool[hidden] { display: none; }
.mode11-batch-cardpool-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.mode11-batch-cardpool-head label { margin-bottom: 0; font-size: 12px; color: var(--text-muted); }
.mode11-batch-cardpool textarea { width: 100%; min-height: 96px; resize: vertical; font-family: "SF Mono","Cascadia Code","Menlo",monospace; white-space: pre; overflow-x: auto; }
.mode11-batch-card-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.mode11-batch-card-results[hidden] { display: none; }
.mode4-cf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 10px 0; align-items: end; }
.mode4-cf-check {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.mode4-cf-check:hover { border-color: var(--border-focus); background: var(--surface); }
.mode4-cf-check:has(input:checked) { border-color: var(--accent); background: var(--accent-glow); }
.mode4-cf-check span { flex: 1; min-width: 0; line-height: 1.25; }
.mode4-cf-check strong,
.mode4-cf-check small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode4-cf-check strong { color: var(--text); font-size: 12px; font-weight: 650; }
.mode4-cf-check small { margin-top: 2px; color: var(--text-muted); font-size: 10px; font-weight: 400; }
.mode4-cf-check input { position: absolute; opacity: 0; pointer-events: none; }
.mode4-cf-check i {
  position: relative;
  width: 30px;
  height: 18px;
  flex: 0 0 30px;
  border-radius: 999px;
  background: var(--border);
  transition: background-color .18s ease;
}
.mode4-cf-check i::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(31, 35, 40, .24);
  transition: transform .18s ease;
}
.mode4-cf-check input:checked + span + i { background: var(--accent); }
.mode4-cf-check input:checked + span + i::after { transform: translateX(12px); }
.mode4-cf-check:has(input:focus-visible) { outline: 2px solid var(--accent-glow); outline-offset: 2px; }
.mode11-batch-card-result { padding: 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.mode11-batch-card-result.is-success { border-color: rgba(26,127,55,0.42); }
.mode11-batch-card-result.is-failed { border-color: rgba(207,34,46,0.38); }
.mode11-batch-card-result textarea { min-height: 72px; background: transparent; }
.mode7-batch-summary { min-height: 20px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.mode7-batch-progress { height: 5px; overflow: hidden; border-radius: 999px; background: var(--border); }
.mode7-batch-progress > div { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.2s ease; }
.mode7-batch-list { display: grid; gap: 5px; max-height: 280px; margin-top: 10px; overflow-y: auto; }
.mode7-batch-row { display: grid; grid-template-columns: 48px minmax(120px, 0.8fr) minmax(160px, 1.2fr); align-items: center; gap: 8px; min-height: 34px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 12px; }
.mode7-batch-index { color: var(--text-muted); font-family: "SF Mono","Cascadia Code","Menlo",monospace; }
.mode7-batch-identity, .mode7-batch-state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode7-batch-state { text-align: right; color: var(--text-muted); }
.mode7-batch-row.is-running { border-color: rgba(9,105,218,0.35); }
.mode7-batch-row.is-running .mode7-batch-state { color: var(--accent); }
.mode7-batch-row.is-success { border-color: rgba(26,127,55,0.32); background: var(--success-bg); }
.mode7-batch-row.is-success .mode7-batch-state { color: var(--success); }
.mode7-batch-row.is-error { border-color: rgba(207,34,46,0.28); background: var(--danger-bg); }
.mode7-batch-row.is-error .mode7-batch-state { color: var(--danger); }

.status-bar { margin-top: 10px; min-height: 22px; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.status-bar.error { color: var(--danger); }
.status-bar.success { color: var(--success); }

.result-card { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.result-card.show { display: block; }
.result-header { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.result-row { margin-bottom: 10px; }
.result-row:last-child { margin-bottom: 0; }
.result-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.result-value { padding: 9px 12px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13px; font-family: "SF Mono","Cascadia Code","Menlo",monospace; word-break: break-all; line-height: 1.5; border: 1px solid var(--border); }
.result-value.success-value { border-color: rgba(26,127,55,0.25); background: var(--success-bg); color: var(--success); }
.result-value.error-value { border-color: rgba(207,34,46,0.25); background: var(--danger-bg); color: var(--danger); }
.upi-qr-shell { position: relative; display: inline-block; width: min(280px, 100%); padding: 12px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; vertical-align: top; }
.upi-qr-shell img { display: block; width: 100%; height: auto; max-height: 280px; background: #fff; image-rendering: pixelated; transition: filter 0.2s ease; }
.upi-qr-shell.is-terminal img { filter: blur(6px); }
.upi-qr-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 14px; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; color: #fff; }
.upi-qr-overlay.show { opacity: 1; }
.upi-qr-overlay-icon { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 44px; line-height: 1; font-weight: 800; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.upi-qr-overlay-text { font-size: 22px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 1px 6px rgba(0,0,0,0.45); }
.upi-qr-overlay.variant-paid { background: rgba(26,127,55,0.86); }
.upi-qr-overlay.variant-paid .upi-qr-overlay-icon { color: #1a7f37; }
.upi-qr-overlay.variant-expired { background: rgba(191,73,14,0.86); }
.upi-qr-overlay.variant-expired .upi-qr-overlay-icon { color: #bf490e; }
.upi-qr-overlay.variant-failed { background: rgba(207,34,46,0.86); }
.upi-qr-overlay.variant-failed .upi-qr-overlay-icon { color: #cf222e; }
.mode12-batch-qr-result { margin-top: 14px; padding: 16px; border: 1px solid rgba(45,164,78,.45); border-radius: 10px; background: rgba(45,164,78,.08); }
.mode12-batch-qr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mode12-batch-qr-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mode12-batch-qr-card { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); }
.mode12-batch-qr-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.mode12-batch-qr-card-account { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text); }
.mode12-batch-qr-card .mode7-batch-count { padding: 2px 7px; border-radius: 999px; background: var(--accent-glow); color: var(--accent); }
.mode12-batch-qr-card img { display: block; width: min(240px, 100%); height: auto; margin: 0 auto 10px; padding: 8px; border-radius: 8px; background: #fff; }
.mode12-batch-qr-expiry { margin-bottom: 12px; color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.error-detail { display: none; margin-top: 14px; }
.error-detail.show { display: block; }
.error-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.error-toolbar span { color: var(--text-muted); font-size: 12px; font-family: "SF Mono","Cascadia Code","Menlo",monospace; }
.error-toolbar button { flex: 0 0 auto; height: 32px; padding: 0 10px; font-size: 12px; }
.error-detail pre { width: 100%; max-width: 100%; padding: 12px 14px; background: var(--danger-bg); border: 1px solid rgba(207,34,46,0.2); border-radius: var(--radius-sm); font-size: 12px; font-family: "SF Mono","Cascadia Code","Menlo",monospace; color: var(--danger); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; max-height: min(70vh, 720px); overflow: auto; line-height: 1.55; }

@media (max-width: 768px) {
  .mode4-cf-grid { grid-template-columns: 1fr; }
  main { padding: 20px 16px; }
  .header h1 { font-size: 20px; }
  .grid-2, .grid-3, .grid-4, .mode-config-grid, .mode11-grid-2, .mode11-grid-3, .mode11-grid-4, .mode11-card-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  textarea { height: auto; min-height: 100px; max-height: none; resize: vertical; }
  .actions { flex-direction: column; align-items: stretch; }
  button, a.btn { width: 100%; }
  .token-refresh { width: 34px; height: 34px; }
  .mode7-batch-head { flex-direction: column; }
  .mode7-batch-count { max-width: 100%; }
  .mode7-batch-controls > * { width: auto; }
  .mode7-batch-row { grid-template-columns: 42px minmax(90px, 0.75fr) minmax(120px, 1.25fr); }
  .mode11-card { padding: 12px; }
  .mode11-section { padding: 12px; }
  .mode11-head { flex-direction: column; }
  .mode11-route { max-width: 100%; white-space: normal; }
  .mode11-span-2, .mode11-card-number { grid-column: auto; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-4, .mode-config-grid, .mode11-grid-4, .mode11-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Theme toggle */
.top-bar { position: fixed; top: 0; left: 0; padding: 16px 24px; z-index: 1100; display: flex; align-items: center; gap: 8px; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-muted); cursor: pointer; transition: all 0.15s; box-shadow: var(--shadow); }
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { width: 18px; height: 18px; flex-shrink: 0; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Login overlay */
.login-overlay { display: none; position: fixed; inset: 0; z-index: 1000; background: var(--bg); align-items: center; justify-content: center; }
.login-overlay.show { display: flex; }
.login-card { width: 100%; max-width: 380px; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); text-align: center; }
.login-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.login-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.login-card input { margin-bottom: 14px; text-align: center; font-size: 15px; letter-spacing: 1px; }
.login-card .login-error { font-size: 13px; color: var(--danger); min-height: 20px; margin-bottom: 10px; }
.login-card button { width: 100%; }

/* Logout button */
.btn-logout { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: 12px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); }
.btn-logout:hover { color: var(--danger); border-color: var(--danger); }
.admin-link { display: inline-flex; align-items: center; text-decoration: none; }
.admin-link:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Two-column Layout ===== */
.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; align-items: stretch; min-width: 0; }
.main-layout.jp-hidden { grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 920px; margin-inline: auto; }
.main-layout.jp-hidden .jp-panel { display: none; }
.main-layout.jp-hidden .pp-panel { width: 100%; }
.main-layout > *, .pp-panel, .pp-panel > div, .field, #accessTokenField { min-width: 0; }
.main-layout > .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .main-layout { grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; } }
@media (max-width: 900px) { .main-layout { grid-template-columns: minmax(0, 1fr); } }

/* ===== JP Generator ===== */
.jp-panel { align-self: start; }
.jp-gen-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.jp-gen-header h2 { font-size: 18px; font-weight: 700; }
.jp-country-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 11px; font-weight: 700; color: var(--danger); background: var(--danger-bg); border-radius: 20px; }
.jp-country-badge.is-br { color: var(--success); background: var(--success-bg); }
.jp-country-badge.is-us { color: var(--accent); background: var(--accent-glow); }
.jp-country-badge.is-gb { color: #6d28d9; background: #ede9fe; }
[data-theme="dark"] .jp-country-badge.is-gb { color: #c4b5fd; background: rgba(139, 92, 246, 0.16); }
.jp-country-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 3px; margin-bottom: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.jp-country-tab { height: 30px; border: none; border-radius: 4px; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: background 0.15s, color 0.15s; }
.jp-country-tab:hover { color: var(--text); background: var(--surface-2); }
.jp-country-tab.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.jp-gen-btn { width: 100%; height: 38px; background: linear-gradient(135deg, #e53935, #d32f2f); color: #fff; font-size: 14px; font-weight: 700; border: none; border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 14px; transition: opacity 0.15s; }
.jp-gen-btn:hover { opacity: 0.9; }

.jp-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 12px; }
.jp-fields .jp-cell { background: var(--surface); padding: 7px 9px; }
.jp-fields .jp-cell.full { grid-column: 1 / -1; }
.jp-fields.is-jp .jp-cell[data-field="street"] { grid-column: auto; }

.jp-field-label { font-size: 14px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.2px; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jp-field-value { font-size: 16px; font-weight: 500; color: var(--text); word-break: break-all; line-height: 1.4; font-family: "SF Mono","Cascadia Code","Menlo",monospace; }

.jp-copy-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 26px; padding: 0 10px; font-size: 12px; font-weight: 700; color: #fff; background: #5c6bc0; border: none; border-radius: 5px; cursor: pointer; transition: background 0.15s, opacity 0.15s; white-space: nowrap; }
.jp-copy-btn:hover { background: #4f5fb5; }
.jp-copy-btn.copied { background: var(--success); }

.jp-copy-all-btn { width: 100%; height: 36px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.jp-copy-all-btn:hover { border-color: var(--accent); background: var(--accent-glow); }

@media (max-width: 768px) {
  .jp-fields { grid-template-columns: 1fr 1fr; }
  .jp-fields .jp-cell.full { grid-column: 1 / -1; }
  .jp-fields.is-jp .jp-cell[data-field="street"] { grid-column: auto; }
}

@media (max-width: 640px) {
  .mode11-batch-card-results { grid-template-columns: 1fr; }
  .mode2-paypal-options { grid-template-columns: 1fr; }
  .proxy-controls { flex-direction: column; gap: 0; }
  .proxy-source-row { width: 100%; grid-template-columns: minmax(0, 1fr); gap: 0; }
  .proxy-pool-field { flex-basis: auto; width: 100%; }
  .proxy-region-field { flex-basis: auto; width: 100%; }
}

@media (max-width: 480px) {
  .mode2-paypal-code-controls { grid-template-columns: minmax(0, 1fr); }
  .mode2-paypal-code-controls button { width: 100%; }
}

@media (max-width: 768px) {
  .mode11-section-heading { flex-direction: column; }
  .mode11-payment-grid, .mode11-manual-card, .mode11-otp-card, .mode11-otp-controls { grid-template-columns: minmax(0, 1fr); }
  .mode11-card-number, .mode11-cardholder, .mode11-expiry-field, .mode11-cvc-field, .mode11-billing-country { grid-column: auto; }
  .mode11-expiry-field, .mode11-cvc-field, .mode11-billing-country { width: auto; max-width: none; }
  .mode11-compact-textarea { white-space: pre-wrap; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .mode11-payment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode11-card-number, .mode11-cardholder { grid-column: span 2; }
  .mode11-expiry-field, .mode11-cvc-field, .mode11-billing-country { grid-column: auto; width: auto; max-width: none; }
}


/* Full-width CJK label visibility fixes */
.result-label {
  line-height: 1.45;
  white-space: normal;
  overflow: visible;
  text-transform: none;
}
.jp-gen-btn,
.jp-copy-all-btn {
  min-height: 40px;
  height: auto;
  padding: 9px 12px;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
}
.jp-fields,
.jp-fields .jp-cell {
  min-width: 0;
}
.jp-field-label {
  min-width: 0;
  line-height: 1.3;
  align-items: flex-start;
  flex-wrap: wrap;
  overflow: visible;
}
.jp-field-label > span {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.jp-copy-btn {
  flex: 0 0 auto;
}
@media (max-width: 420px) {
  .jp-fields { grid-template-columns: 1fr; }
}
