* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #fafbfc; color: #1a1a2e; }

/* Auth */
.auth-card { max-width: 380px; margin: 120px auto; padding: 40px; background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.auth-card h1 { margin-bottom: 20px; font-size: 26px; font-weight: 700; }
.auth-card p { margin-bottom: 16px; color: #64748b; font-size: 14px; }
.auth-card input { display: block; width: 100%; padding: 11px 14px; margin-bottom: 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; transition: border-color .15s; }
.auth-card input:focus { outline: none; border-color: #635bff; box-shadow: 0 0 0 3px rgba(99,91,255,.1); }
.auth-card button { display: block; width: 100%; padding: 11px; background: #635bff; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
.auth-card button:hover { background: #4b44c9; }

/* Terms gate */
.terms-gate { max-width: 760px; margin: 48px auto; padding: 40px; background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.terms-gate h1 { margin-bottom: 12px; font-size: 26px; font-weight: 700; }
.terms-gate-intro { margin-bottom: 20px; color: #64748b; font-size: 14px; }
.terms-content { max-height: 60vh; overflow-y: auto; padding: 4px 20px 4px 0; border-bottom: 1px solid #e8ecf0; font-size: 14px; line-height: 1.6; color: #334155; }
.terms-content h1 { font-size: 22px; margin: 0 0 8px; }
.terms-content h2 { font-size: 16px; margin: 24px 0 8px; color: #1a1a2e; }
.terms-content p { margin-bottom: 12px; }
.terms-content a { color: #635bff; }
.terms-gate-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
#btn-accept-terms { padding: 11px 22px; background: #635bff; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
#btn-accept-terms:hover:not(:disabled) { background: #4b44c9; }
#btn-accept-terms:disabled { opacity: .5; cursor: default; }

/* Nav */
nav { display: flex; align-items: center; padding: 14px 28px; background: #fff; border-bottom: 1px solid #e8ecf0; }
.nav-brand { font-weight: 700; font-size: 17px; margin-right: 36px; color: #1a1a2e; text-decoration: none; }
.nav-brand span, .brand span { color: #635bff; position: relative; top: -1px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { color: #64748b; text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 6px; transition: all .15s; }
.nav-links a.active { color: #1a1a2e; background: #f1f5f9; }
.nav-links a:hover { color: #1a1a2e; background: #f8fafc; }
.btn-text { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 13px; font-weight: 500; transition: color .15s; }
.btn-text:hover { color: #64748b; }

/* Main */
main { max-width: 900px; margin: 32px auto; padding: 0 24px; }
h2 { margin-bottom: 20px; font-size: 22px; font-weight: 600; color: #1a1a2e; }
h3 { margin: 24px 0 12px; font-size: 16px; font-weight: 600; }
.loading { color: #94a3b8; }

/* Stats */
.stats { display: flex; gap: 16px; margin-bottom: 28px; }
.stat-card { flex: 1; background: #fff; padding: 22px; border-radius: 12px; border: 1px solid #e8ecf0; }
.stat-label { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; color: #1a1a2e; }

/* Onboard banner */
.onboard-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(135deg,#eef0ff 0%,#f5f3ff 100%); border: 1px solid #c7d2fe; padding: 20px 24px; border-radius: 12px; margin-bottom: 24px; }
.onboard-banner strong { font-size: 15px; display: block; color: #1a1a2e; margin-bottom: 2px; }
.onboard-banner p { font-size: 13px; color: #64748b; margin: 0; }
.btn-primary { display: inline-block; padding: 10px 18px; background: #635bff; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn-primary:hover { background: #4b44c9; }

/* Revenue chart */
.chart-card { background: #fff; border: 1px solid #e8ecf0; border-radius: 12px; padding: 22px 24px 18px; margin-bottom: 24px; }
.chart-header { margin-bottom: 20px; }
.chart-label { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; font-weight: 500; }
.chart-value { font-size: 32px; font-weight: 700; color: #1a1a2e; line-height: 1.1; margin-top: 4px; }
.chart-sub { font-size: 13px; color: #64748b; margin-top: 4px; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 100px; }
.chart-bar { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.chart-fill { width: 100%; background: linear-gradient(180deg, #635bff 0%, #847cff 100%); border-radius: 2px 2px 0 0; min-height: 0; transition: background .15s; cursor: pointer; }
.chart-fill:hover { background: #4b44c9; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: #94a3b8; }

/* Recent activity */
.activity-card { background: #fff; border: 1px solid #e8ecf0; border-radius: 12px; padding: 18px 24px; margin-bottom: 24px; }
.activity-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.activity-header h3 { margin: 0; }
.activity-header a { font-size: 13px; color: #635bff; text-decoration: none; }
.activity-header a:hover { text-decoration: underline; }
.activity-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid #f1f5f9; font-size: 13px; color: #334155; text-decoration: none; }
.activity-row:hover { color: #1a1a2e; }
.activity-date { color: #94a3b8; }
.activity-desc { color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-amount { font-weight: 600; color: #1a1a2e; }
.muted { color: #94a3b8; font-size: 13px; margin: 8px 0; }
.hint { font-size: 13px; color: #64748b; padding: 14px 16px; background: #f8fafc; border-radius: 8px; }
.hint a { color: #635bff; text-decoration: none; font-weight: 500; }
.hint a:hover { text-decoration: underline; }

/* Info */
.info-row { margin-bottom: 12px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.info-row .label { font-weight: 500; color: #64748b; }
code { background: #f1f5f9; padding: 3px 7px; border-radius: 4px; font-size: 13px; word-break: break-all; color: #334155; }

/* Secret field */
.secret-field { display: inline-flex; align-items: center; gap: 6px; background: #f1f5f9; padding: 5px 10px; border-radius: 6px; }
.secret-field code { background: none; padding: 0; font-family: monospace; min-width: 140px; }
.secret-masked { color: #94a3b8; letter-spacing: 2px; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 4px; line-height: 1; color: #64748b; transition: all .15s; }
.btn-icon:hover { background: #e2e8f0; color: #1a1a2e; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid #e8ecf0; }
thead { background: #f8fafc; }
th { text-align: left; padding: 11px 16px; font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid #e8ecf0; }
td { text-align: left; padding: 12px 16px; font-size: 13px; border-bottom: 1px solid #f1f5f9; color: #334155; }
th:first-child, td:first-child { white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.badge-succeeded { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-failed { background: #fee2e2; color: #991b1b; }

/* Buttons */
.btn-small { padding: 5px 12px; font-size: 12px; font-weight: 500; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; cursor: pointer; color: #334155; transition: all .15s; }
.btn-small:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
button#btn-onboard { padding: 11px 22px; background: #635bff; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
button#btn-onboard:hover { background: #4b44c9; }

.connect-summary { border-top: 1px solid #e8ecf0; padding-top: 16px; }
.connect-status { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.connect-status-pending { color: #475569; }
.connect-status-action { color: #92400e; }
.connect-status-ready { color: #166534; }
.connect-summary p, .connect-note { font-size: 13px; line-height: 1.6; max-width: 640px; margin-bottom: 8px; }
.connect-note { color: #64748b; }
.connect-requirements { padding-left: 20px; font-size: 13px; line-height: 1.6; margin-bottom: 8px; overflow-wrap: anywhere; }
.connect-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.connect-actions .btn-small { padding: 10px 14px; font-size: 13px; }
.connect-actions button { max-width: 100%; white-space: normal; }

.transfer-history-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.transfer-history-header h3 { margin: 0; }
.transfer-history-header button { flex-shrink: 0; }
.transfer-table-scroll { max-width: 100%; overflow-x: auto; }
.transfer-table { border-radius: 0; min-width: 840px; }
.transfer-table .transfer-amount { white-space: nowrap; }
.transfer-table code { display: inline-block; max-width: 240px; overflow-wrap: anywhere; }
.transfer-pmn-id { display: inline-block; max-width: 220px; font-family: monospace; font-size: 12px; overflow-wrap: anywhere; }
.badge-completed { background: #dcfce7; color: #166534; }
.held-funds-section { border-bottom: 1px solid #e8ecf0; padding-bottom: 20px; }
.held-funds-section .transfer-history-header { margin: 0 0 12px; }
.held-funds-content { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.held-balances { display: flex; flex-wrap: wrap; gap: 16px; }
.held-funds-reason { margin-top: 12px; }
.held-funds-section .error:empty, .transfer-dialog .error:empty { display: none; }
.held-balance { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.held-balance strong { font-size: 22px; font-weight: 600; }
.transfer-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; margin: auto; padding: 24px; border: 1px solid #e2e8f0; border-radius: 8px; color: #1a1a2e; }
.transfer-dialog::backdrop { background: rgba(0,0,0,.4); }
.transfer-dialog h3 { margin: 0 0 20px; }
.transfer-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; border-top: 1px solid #e8ecf0; padding: 16px 0; font-size: 13px; line-height: 1.5; }
.transfer-review dt { color: #64748b; }
.transfer-review dd { text-align: right; overflow-wrap: anywhere; }
.transfer-review .transfer-received { font-weight: 600; color: #166534; }
.transfer-dialog .connect-actions { flex-wrap: wrap; }
.btn-primary:disabled, .btn-small:disabled { opacity: .5; cursor: not-allowed; }
.transfer-success { color: #166534; font-size: 13px; margin-top: 8px; }

/* Forms */
.form-inline { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.form-inline input { padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; transition: border-color .15s; }
.form-inline input:focus { outline: none; border-color: #635bff; box-shadow: 0 0 0 3px rgba(99,91,255,.1); }
.form-inline input[type="text"] { flex: 2; }
.form-inline select { padding: 9px 32px 9px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; background: #fff; }
.form-inline button { padding: 9px 18px; background: #635bff; color: #fff; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s; }
.form-inline button:hover { background: #4b44c9; }

/* Error */
.error { color: #dc2626; font-size: 13px; margin-top: 8px; }

/* Snippet box */
.snippet-box { position: relative; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px; margin-top: 8px; }
.snippet-box pre { margin: 0; white-space: pre-wrap; word-break: break-all; font-size: 12px; color: #334155; line-height: 1.5; }
.snippet-box code { background: none; padding: 0; font-size: 12px; }
.snippet-box .btn-small { position: absolute; top: 10px; right: 10px; }

/* Demo */
.test-product-grid, .test-example-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.test-product, .test-example { padding: 16px; border: 1px solid #e8ecf0; border-radius: 8px; background: #fff; min-width: 0; }
.test-product h3, .test-example h3 { margin: 0 0 8px; overflow-wrap: anywhere; }
#test-embed-error:empty { display: none; }
.test-product-price { font-size: 14px; color: #64748b; margin-bottom: 16px; }
.test-product-actions { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.test-cart-add { padding: 10px 16px; font-size: 14px; font-weight: 500; }
.test-product .pmn-trigger, .test-example .pmn-trigger { white-space: normal; max-width: 100%; padding: 10px 16px; font-size: 14px; }
.test-product .paymenow-form { display: flex; }
.test-product .test-cart-add { white-space: normal; max-width: 100%; }
.test-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #e8ecf0; }
.test-header h2 { margin: 0; }
.payment-delivery { font-size: 13px; line-height: 1.4; min-width: 160px; }
.product-description { font-size: 13px; color: #64748b; margin-top: 2px; max-width: 360px; }
.product-editor input, .product-editor textarea, .product-editor select { width: 100%; padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font: inherit; font-size: 14px; }
.product-editor-note { margin: 14px 0 0; font-size: 12px; color: #94a3b8; line-height: 1.5; }
.product-editor-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.test-docs-link { margin-bottom: 20px; font-size: 14px; }
.test-cart-section { display: flex; align-items: center; gap: 12px; }
.test-cart-section p { margin: 0; font-size: 14px; }
.test-cart-section #paymenow-cart { position: relative; flex-shrink: 0; }
.test-cart-section .pmn-cart-dropdown { right: 0; max-width: calc(100vw - 48px); }
.demo-subtitle { color: #64748b; font-size: 14px; margin-bottom: 24px; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; margin-bottom: 28px; }
.demo-card { background: #fff; border: 1px solid #e8ecf0; border-radius: 12px; padding: 16px; }
.demo-label { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 12px; }
.demo-embed .pmn-form { max-width: none; }
.demo-embed .pmn-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: #1a1a2e; }
.demo-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 99999; overflow-y: auto; padding: 20px; }
.demo-cart-row { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.demo-cart-buttons { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.demo-cart-buttons .paymenow-add { display: inline-block; }

/* Embed Editor */
.embed-editor { position: relative; background: #fff; border-radius: 12px; max-width: 740px; width: 100%; margin: 16px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.embed-editor-header { position: sticky; top: 0; background: #fff; z-index: 10; padding: 20px 28px 0; border-radius: 12px 12px 0 0; display: flex; justify-content: space-between; align-items: center; }
.embed-editor-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
.embed-editor-header .pmn-close { position: static; font-size: 22px; color: #94a3b8; background: none; border: none; cursor: pointer; padding: 4px; line-height: 1; }
.embed-editor-header .pmn-close:hover { color: #475569; }
.embed-editor-body { padding: 20px 28px 28px; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.editor-controls label { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 4px; margin-top: 12px; }
.editor-controls label:first-child { margin-top: 0; }
.editor-controls label .hint { font-weight: 400; color: #94a3b8; }
.editor-controls input[type="text"] { width: 100%; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; }
.editor-controls input[type="text"]:focus { outline: none; border-color: #635bff; }
.editor-controls input[type="color"] { width: 48px; height: 32px; border: 1px solid #e2e8f0; border-radius: 6px; padding: 2px; cursor: pointer; }
.editor-actions { margin-top: 16px; }
.editor-preview { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 16px; background: #f8fafc; border-radius: 8px; border: 1px solid #e8ecf0; }
.editor-preview-label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; align-self: flex-start; }
.editor-preview .pmn-form { max-width: none; width: 100%; box-shadow: none; border: 1px solid #e2e8f0; }
.editor-preview .pmn-trigger { margin-bottom: 0; }

/* Cart editor */
.cart-product-list { max-height: 150px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px; background: #fff; }
.cart-product-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; padding: 4px 0; cursor: pointer; }
.cart-product-check input { margin: 0; cursor: pointer; }
.editor-controls textarea { border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 10px; }
.editor-controls textarea:focus { outline: none; border-color: #635bff; }
