﻿: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;
}

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; }
.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; }

.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; }
.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) 72px; 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); }
.mode7-batch-run { height: 28px; padding: 0 10px; font-size: 12px; white-space: nowrap; }

.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; }

.error-detail { display: none; margin-top: 14px; }
.error-detail.show { display: block; }
.error-detail pre { 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-all; max-height: 220px; overflow-y: auto; line-height: 1.55; }

@media (max-width: 768px) {
  main { padding: 20px 16px; }
  .header h1 { font-size: 20px; }
  .grid-2, .grid-3, .grid-4, .mode-config-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) 64px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-4, .mode-config-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); }

/* ===== Two-column Layout ===== */
.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; align-items: start; min-width: 0; }
.main-layout.jp-hidden .jp-panel { display: none; }
.main-layout > *, .pp-panel, .pp-panel > div, .field, #accessTokenField { min-width: 0; }
.main-layout > .card + .card { margin-top: 0; }
.pp-panel { grid-row: 1 / span 2; }
.task-board-panel, .jp-panel { grid-column: 2; }
@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); } .pp-panel, .task-board-panel, .jp-panel { grid-column: auto; grid-row: auto; } }

/* ===== 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) {
  .mode2-paypal-options { grid-template-columns: 1fr; }
  .proxy-controls { flex-direction: column; 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%; }
}


/* ===== Realtime task board ===== */
.task-board-panel { align-self: start; max-height: calc(100vh - 80px); overflow: auto; }
.task-board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.task-board-head h2 { font-size: 18px; font-weight: 800; margin: 0; }
.task-board-head p { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.task-board-actions { flex: 0 0 auto; display: flex; gap: 6px; }
.task-board-refresh, .task-board-export, .task-board-clear, .task-board-lang { height: 32px; padding-inline: 10px; }
.task-board-grid { display: grid; gap: 12px; }
.task-module { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.task-module-title { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; font-size: 13px; font-weight: 800; color: var(--text); border-bottom: 1px solid var(--border); background: var(--surface); }
.task-module-title span { min-width: 22px; height: 22px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent-glow); color: var(--accent); font-size: 12px; }
.task-paid-count { margin-left: 6px; background: rgba(26,127,55,.12) !important; color: var(--success) !important; }
.task-module-list { display: grid; gap: 6px; min-height: 44px; max-height: 360px; overflow-y: auto; padding: 7px; }
.task-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 8px 0; }
.task-card { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 7px 8px; box-shadow: var(--shadow); }
.task-card.is-running { border-color: rgba(9,105,218,.35); }
.task-card.is-scanning { border-color: rgba(154,103,0,.38); }
.task-card.is-success { border-color: rgba(26,127,55,.35); }
.task-card.is-paid { border-color: rgba(26,127,55,.48); }
.task-card.is-expired, .task-card.is-pay_failed { border-color: rgba(207,34,46,.3); }
.task-card.is-error { border-color: rgba(207,34,46,.3); }
.task-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.task-title { min-width: 0; display: flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 800; }
.task-card-actions { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.task-email-copy { flex: 0 1 auto; min-width: 0; max-width: 100%; padding: 0; border: none; background: transparent; color: var(--accent); cursor: pointer; font: inherit; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-email-copy:hover { text-decoration: underline; }
.task-email-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.task-status { flex: 0 0 auto; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 2px 7px; color: var(--accent); background: var(--accent-glow); }
.task-run-btn { flex: 0 0 auto; height: 24px; min-width: 52px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1; }
.task-run-btn:disabled { opacity: .65; cursor: not-allowed; }
.task-card.is-scanning .task-status { color: #9a6700; background: rgba(251,188,5,.14); }
.task-card.is-success .task-status { color: var(--success); background: var(--success-bg); }
.task-card.is-paid .task-status { color: var(--success); background: var(--success-bg); }
.task-card.is-expired .task-status, .task-card.is-pay_failed .task-status { color: var(--danger); background: var(--danger-bg); }
.task-card.is-error .task-status { color: var(--danger); background: var(--danger-bg); }
.task-detail, .task-callback, .task-time { font-size: 11px; color: var(--text-muted); line-height: 1.3; word-break: break-word; }
.task-callback { margin-top: 2px; color: var(--text); opacity: .82; }
.task-link { display: block; margin-top: 2px; font-size: 11px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-qr { display: block; width: 96px; max-width: 100%; margin: 2px 0 0; padding: 4px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.task-qr img { display: block; width: 100%; height: auto; background: #fff; }

.main-layout.results-only { grid-template-columns: minmax(0, 980px); justify-content: center; max-width: 980px; margin-inline: auto; }
.main-layout.results-only .pp-panel,
.main-layout.results-only .jp-panel { display: none !important; }
.main-layout.results-only .task-board-panel { grid-column: 1; max-height: none; }
.main-layout.results-only .task-board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .main-layout.results-only .task-board-grid { grid-template-columns: minmax(0, 1fr); } }

.task-board-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.task-board-tabs a { display: flex; align-items: center; justify-content: center; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 800; }
.task-board-tabs a.active { background: var(--accent-glow); color: var(--accent); border-color: rgba(9,105,218,.35); }
.main-layout.results-only .task-board-grid { grid-template-columns: minmax(0, 1fr); }
.task-module[hidden] { display: none !important; }

.task-field-label { margin-top: 4px; font-size: 10px; line-height: 1.2; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .2px; }

/* result page: full-height task list + larger QR */
.main-layout.results-only { max-width: min(1180px, calc(100vw - 32px)); }
.main-layout.results-only .task-board-panel { min-height: calc(100vh - 80px); max-height: none; display: flex; flex-direction: column; }
.main-layout.results-only .task-board-grid { flex: 1 1 auto; min-height: 0; display: flex; }
.main-layout.results-only .task-module:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.main-layout.results-only .task-module-list { flex: 1 1 auto; max-height: none; min-height: calc(100vh - 260px); }
.main-layout.results-only .task-link { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; word-break: break-all; }
.main-layout.results-only .task-qr { width: 180px; }
@media (max-width: 760px) { .main-layout.results-only .task-qr { width: 150px; } }
