/* Affiliate Suite – front end. Override the variables in your theme to restyle. */
.afs-wrap {
	--afs-accent: #4f46e5;
	--afs-accent-ink: #fff;
	--afs-ink: #111827;
	--afs-muted: #6b7280;
	--afs-line: #e5e7eb;
	--afs-bg: #fff;
	--afs-soft: #f9fafb;
	--afs-radius: 12px;
	color: var(--afs-ink);
	font-size: 15px;
	line-height: 1.5;
	max-width: 1100px;
	margin: 0 auto;
	box-sizing: border-box;
}
.afs-wrap *, .afs-wrap *::before, .afs-wrap *::after { box-sizing: inherit; }
.afs-wrap h3 { margin: 0 0 12px; font-size: 1.35em; }
.afs-wrap h4 { margin: 24px 0 10px; font-size: 1.05em; }
.afs-muted { color: var(--afs-muted); }
.afs-hp { position: absolute !important; left: -9999px !important; height: 0; width: 0; opacity: 0; }

/* Cards / alerts */
.afs-card { background: var(--afs-bg); border: 1px solid var(--afs-line); border-radius: var(--afs-radius); padding: 18px; margin: 0 0 16px; }
.afs-alert { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; border: 1px solid; }
.afs-alert ul { margin: 0; padding-left: 18px; }
.afs-alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.afs-alert-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.afs-alert-info { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.afs-status h3 { margin-bottom: 6px; }
.afs-status-pending { border-left: 4px solid #f59e0b; }
.afs-status-rejected, .afs-status-suspended { border-left: 4px solid #ef4444; }
.afs-empty { color: var(--afs-muted); padding: 18px; text-align: center; border: 1px dashed var(--afs-line); border-radius: var(--afs-radius); }

/* Buttons */
.afs-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--afs-line); background: var(--afs-bg); color: var(--afs-ink); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.afs-btn:hover { border-color: var(--afs-accent); color: var(--afs-accent); }
.afs-btn-primary { background: var(--afs-accent); border-color: var(--afs-accent); color: var(--afs-accent-ink); }
.afs-btn-primary:hover { color: var(--afs-accent-ink); filter: brightness(1.08); }
.afs-btn.is-done { background: #16a34a; border-color: #16a34a; color: #fff; }

/* Forms */
.afs-form .afs-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
.afs-field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.afs-field small, .afs-help { font-weight: 400; color: var(--afs-muted); }
.afs-field input, .afs-field select, .afs-field textarea, .afs-filter input, .afs-filter select, .afs-generator input, .afs-copyrow input {
	width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--afs-line); border-radius: 10px; background: var(--afs-bg); color: var(--afs-ink); font: inherit; font-weight: 400;
}
.afs-field textarea { min-height: 100px; }
.afs-field input:focus, .afs-field select:focus, .afs-field textarea:focus { outline: 2px solid var(--afs-accent); outline-offset: 0; border-color: transparent; }
.afs-static { padding: 10px 12px; background: var(--afs-soft); border-radius: 10px; font-weight: 400; }
.afs-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.afs-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.afs-register .afs-btn-primary { width: 100%; }

/* Tabs */
.afs-tabs { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 0 18px; padding-bottom: 2px; border-bottom: 1px solid var(--afs-line); }
.afs-tabs::-webkit-scrollbar { display: none; }
.afs-tabs a { flex: none; padding: 10px 14px; border-radius: 10px 10px 0 0; color: var(--afs-muted); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; }
.afs-tabs a.is-active { color: var(--afs-accent); border-bottom-color: var(--afs-accent); }

/* Stats */
.afs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.afs-stat { background: var(--afs-soft); border: 1px solid var(--afs-line); border-radius: var(--afs-radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.afs-stat-label { font-size: 12px; color: var(--afs-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.afs-stat-value { font-size: 1.35em; font-weight: 700; overflow-wrap: anywhere; }
.afs-stat-sub { font-size: 12px; color: var(--afs-muted); }

/* Rank */
.afs-rank { display: flex; flex-direction: column; gap: 10px; }
.afs-rank strong { display: block; font-size: 1.15em; }
.afs-bar { height: 8px; background: var(--afs-line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.afs-bar i { display: block; height: 100%; background: var(--afs-accent); border-radius: 99px; }

/* Copy rows / share / generator */
.afs-copyrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.afs-copyrow > .afs-muted { grid-column: 1 / -1; font-size: 13px; font-weight: 600; }
.afs-copyrow input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.afs-share { display: flex; flex-wrap: wrap; gap: 8px; }
.afs-generator { display: grid; grid-template-columns: 1fr; gap: 8px; }
.afs-gen-out { margin: 0; }

/* Tables → cards on mobile */
.afs-table-wrap { width: 100%; }
.afs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.afs-table thead { display: none; }
.afs-table tr { display: block; border: 1px solid var(--afs-line); border-radius: var(--afs-radius); padding: 10px 14px; margin-bottom: 10px; background: var(--afs-bg); }
.afs-table td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; overflow-wrap: anywhere; }
.afs-table td::before { content: attr(data-l); color: var(--afs-muted); font-weight: 600; text-align: left; flex: none; }
.afs-inline-bar { display: none; }

.afs-pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--afs-soft); white-space: nowrap; }
.afs-pill-pending { background: #fef3c7; color: #92400e; }
.afs-pill-unpaid { background: #dbeafe; color: #1e40af; }
.afs-pill-paid { background: #dcfce7; color: #166534; }
.afs-pill-rejected { background: #fee2e2; color: #991b1b; }

.afs-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.afs-filter label { display: flex; flex-direction: column; font-size: 12px; color: var(--afs-muted); gap: 4px; flex: 1 1 140px; }
.afs-pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.afs-pager a { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--afs-line); border-radius: 8px; text-decoration: none; color: var(--afs-ink); }
.afs-pager a.is-active { background: var(--afs-accent); border-color: var(--afs-accent); color: #fff; }

@media (min-width: 640px) {
	.afs-form .afs-grid { grid-template-columns: 1fr 1fr; }
	.afs-full { grid-column: 1 / -1; }
	.afs-register .afs-btn-primary { width: auto; }
	.afs-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.afs-generator { grid-template-columns: 1fr auto; }
	.afs-gen-out, .afs-gen-err { grid-column: 1 / -1; }
	.afs-rank { flex-direction: row; align-items: center; justify-content: space-between; }
	.afs-rank-next { flex: 1; max-width: 60%; }
	.afs-copyrow { grid-template-columns: 110px 1fr auto; }
	.afs-copyrow > .afs-muted { grid-column: auto; }
}

@media (min-width: 820px) {
	.afs-table-wrap { overflow-x: auto; border: 1px solid var(--afs-line); border-radius: var(--afs-radius); }
	.afs-table thead { display: table-header-group; }
	.afs-table tr { display: table-row; border: 0; border-radius: 0; padding: 0; margin: 0; }
	.afs-table th { text-align: left; padding: 11px 14px; background: var(--afs-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--afs-muted); border-bottom: 1px solid var(--afs-line); }
	.afs-table td { display: table-cell; text-align: left; padding: 11px 14px; border-top: 1px solid var(--afs-line); }
	.afs-table tbody tr:first-child td { border-top: 0; }
	.afs-table td::before { content: none; }
	.afs-inline-bar { display: block; height: 4px; background: var(--afs-line); border-radius: 99px; margin-bottom: 4px; max-width: 120px; }
	.afs-inline-bar i { display: block; height: 100%; background: var(--afs-accent); border-radius: 99px; }
}
