/**
 * Painel do afiliado — estilos front.
 *
 * Author: Rafael Silva
 * Version: 1.5
 */

/* Página full width (fallback se o template do tema falhar) */
body.rs-aff-dashboard-page .widget-area,
body.rs-aff-dashboard-page #secondary {
	display: none !important;
}

@media (min-width: 993px) {
	body.rs-aff-dashboard-page .content-area {
		width: 100% !important;
		max-width: 100% !important;
		float: none !important;
	}
}

.rs-aff-panel {
	--rs-aff-bg: #f4f7fb;
	--rs-aff-surface: #ffffff;
	--rs-aff-ink: #1a2744;
	--rs-aff-muted: #5a6a85;
	--rs-aff-blue: #0034a4;
	--rs-aff-blue-soft: #e8eefc;
	--rs-aff-line: #d7deea;
	--rs-aff-ok: #1f7a4c;
	--rs-aff-ok-bg: #e8f6ee;
	--rs-aff-warn: #9a6700;
	--rs-aff-warn-bg: #fff6e0;
	--rs-aff-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
	--rs-aff-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
	--rs-aff-radius: 14px;
	box-sizing: border-box;
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
	padding: 28px 20px 48px;
	font-family: var(--rs-aff-body);
	color: var(--rs-aff-ink);
	background:
		radial-gradient(120% 80% at 0% 0%, rgba(0, 52, 164, 0.08), transparent 55%),
		var(--rs-aff-bg);
	border-radius: 18px;
}

.rs-aff-panel *,
.rs-aff-panel *::before,
.rs-aff-panel *::after {
	box-sizing: border-box;
}

.rs-aff-panel .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.rs-aff-panel__hero {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 28px;
	padding-bottom: 22px;
	border-bottom: 1px solid var(--rs-aff-line);
}

.rs-aff-panel__eyebrow {
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--rs-aff-blue);
}

.rs-aff-panel__title {
	margin: 0 0 8px;
	font-family: var(--rs-aff-display);
	font-size: clamp(1.75rem, 4vw, 2.35rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1.1;
	color: var(--rs-aff-ink);
}

.rs-aff-panel__lead {
	margin: 0;
	max-width: 36ch;
	font-size: 1rem;
	line-height: 1.45;
	color: var(--rs-aff-muted);
}

.rs-aff-panel__ranges {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 4px;
	background: var(--rs-aff-surface);
	border: 1px solid var(--rs-aff-line);
	border-radius: 999px;
}

.rs-aff-panel__range {
	display: inline-flex;
	align-items: center;
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--rs-aff-muted);
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
}

.rs-aff-panel__range:hover,
.rs-aff-panel__range:focus-visible {
	color: var(--rs-aff-ink);
	background: var(--rs-aff-blue-soft);
	outline: none;
}

.rs-aff-panel__range.is-active {
	color: #fff;
	background: var(--rs-aff-blue);
}

.rs-aff-panel__kpis {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 0;
	margin-bottom: 36px;
	background: var(--rs-aff-surface);
	border: 1px solid var(--rs-aff-line);
	border-radius: var(--rs-aff-radius);
	overflow: hidden;
	animation: rs-aff-fade-up 0.45s ease both;
}

.rs-aff-panel__kpis--4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rs-aff-panel__kpi {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px 16px;
	min-width: 0;
	border-right: 1px solid var(--rs-aff-line);
}

.rs-aff-panel__kpi:last-child {
	border-right: 0;
}

.rs-aff-panel__kpi-value {
	font-family: var(--rs-aff-display);
	font-size: clamp(1.25rem, 2.5vw, 1.65rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.15;
	color: var(--rs-aff-ink);
	word-break: break-word;
}

.rs-aff-panel__kpi-label {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--rs-aff-muted);
}

.rs-aff-panel__section {
	margin-bottom: 32px;
}

.rs-aff-panel__section-head {
	margin-bottom: 16px;
}

.rs-aff-panel__section-title {
	margin: 0 0 6px;
	font-family: var(--rs-aff-display);
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.rs-aff-panel__section-desc {
	margin: 0;
	font-size: 0.95rem;
	color: var(--rs-aff-muted);
}

.rs-aff-panel__empty {
	padding: 22px;
	background: var(--rs-aff-surface);
	border: 1px dashed var(--rs-aff-line);
	border-radius: var(--rs-aff-radius);
}

.rs-aff-panel__empty p {
	margin: 0;
	color: var(--rs-aff-muted);
}

.rs-aff-panel__table-wrap {
	overflow-x: auto;
	background: var(--rs-aff-surface);
	border: 1px solid var(--rs-aff-line);
	border-radius: var(--rs-aff-radius);
}

.rs-aff-panel__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.rs-aff-panel__table th,
.rs-aff-panel__table td {
	padding: 14px 16px;
	text-align: left;
	border-bottom: 1px solid var(--rs-aff-line);
	vertical-align: middle;
}

.rs-aff-panel__table th {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--rs-aff-muted);
	background: rgba(244, 247, 251, 0.85);
}

.rs-aff-panel__table tr:last-child td {
	border-bottom: 0;
}

.rs-aff-panel__code-inline,
.rs-aff-panel__table code {
	font-family: var(--rs-aff-display);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: var(--rs-aff-blue);
	background: transparent;
	padding: 0;
}

.rs-aff-panel__code-link {
	text-decoration: none;
}

.rs-aff-panel__code-link:hover .rs-aff-panel__code-inline,
.rs-aff-panel__code-link:focus-visible .rs-aff-panel__code-inline {
	text-decoration: underline;
	text-underline-offset: 3px;
	outline: none;
}

.rs-aff-panel__title-code {
	font-family: var(--rs-aff-display);
	font-size: inherit;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: var(--rs-aff-blue);
	background: transparent;
	padding: 0;
}

.rs-aff-panel__back-wrap {
	margin: 0 0 12px;
}

.rs-aff-panel__back {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--rs-aff-blue);
	text-decoration: none;
}

.rs-aff-panel__back:hover,
.rs-aff-panel__back:focus-visible {
	text-decoration: underline;
	outline: none;
}

.rs-aff-panel__detail-share-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.rs-aff-panel__detail-share-row .rs-aff-panel__share-input {
	flex: 1 1 240px;
	max-width: none;
}

.rs-aff-panel__pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 14px;
	padding: 0 2px;
}

.rs-aff-panel__pager-info {
	font-size: 0.875rem;
	color: var(--rs-aff-muted);
}

.rs-aff-panel__pager-links {
	display: flex;
	gap: 8px;
}

.rs-aff-panel__pager-btn {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 6px 14px;
	border: 1px solid var(--rs-aff-line);
	border-radius: 999px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--rs-aff-blue);
	background: var(--rs-aff-surface);
	text-decoration: none;
}

.rs-aff-panel__pager-btn:hover,
.rs-aff-panel__pager-btn:focus-visible {
	background: var(--rs-aff-blue-soft);
	outline: none;
}

.rs-aff-panel__pager-btn.is-disabled {
	color: var(--rs-aff-muted);
	opacity: 0.55;
	pointer-events: none;
}

.rs-aff-panel__sku {
	font-family: var(--rs-aff-display);
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--rs-aff-ink);
	background: transparent;
	padding: 0;
}

.rs-aff-panel__product-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rs-aff-panel__product-link {
	color: var(--rs-aff-blue);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.rs-aff-panel__product-link:hover,
.rs-aff-panel__product-link:focus-visible {
	color: #002a85;
	outline: none;
}

.rs-aff-panel__muted {
	color: var(--rs-aff-muted);
}

.rs-aff-panel__link-cell {
	min-width: 220px;
}

.rs-aff-panel__link-hint {
	display: block;
	margin-bottom: 4px;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--rs-aff-muted);
}

.rs-aff-panel__share-input {
	width: 100%;
	max-width: 420px;
	padding: 9px 12px;
	border: 1px solid var(--rs-aff-line);
	border-radius: 8px;
	font-family: var(--rs-aff-body);
	font-size: 0.8125rem;
	color: var(--rs-aff-ink);
	background: var(--rs-aff-bg);
}

.rs-aff-panel__share-input:focus {
	outline: 2px solid var(--rs-aff-blue);
	outline-offset: 1px;
}

.rs-aff-panel__action-cell {
	width: 1%;
	white-space: nowrap;
}

.rs-aff-panel__copy {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 8px 18px;
	border: 0;
	border-radius: 999px;
	font-family: var(--rs-aff-body);
	font-size: 0.875rem;
	font-weight: 700;
	color: #fff;
	background: var(--rs-aff-blue);
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.15s ease, background 0.15s ease;
}

.rs-aff-panel__copy--compact {
	min-height: 36px;
	padding: 7px 14px;
}

.rs-aff-panel__copy:hover,
.rs-aff-panel__copy:focus-visible {
	background: #002a85;
	outline: none;
}

.rs-aff-panel__copy:active {
	transform: scale(0.98);
}

.rs-aff-panel__copy.is-copied {
	background: var(--rs-aff-ok);
}

.rs-aff-panel__status {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
}

.rs-aff-panel__status.is-pending {
	color: var(--rs-aff-warn);
	background: var(--rs-aff-warn-bg);
}

.rs-aff-panel__status.is-paid {
	color: var(--rs-aff-ok);
	background: var(--rs-aff-ok-bg);
}

.rs-aff-panel--gate {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 280px;
}

.rs-aff-panel__gate {
	max-width: 28rem;
	text-align: center;
}

.rs-aff-panel__gate .rs-aff-panel__copy {
	margin-top: 18px;
}

@keyframes rs-aff-fade-up {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (max-width: 860px) {
	.rs-aff-panel__kpis {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rs-aff-panel__kpi {
		border-right: 0;
		border-bottom: 1px solid var(--rs-aff-line);
	}

	.rs-aff-panel__kpi:nth-child(odd) {
		border-right: 1px solid var(--rs-aff-line);
	}

	.rs-aff-panel__kpi:last-child {
		grid-column: 1 / -1;
		border-right: 0;
		border-bottom: 0;
	}
}

@media (max-width: 720px) {
	.rs-aff-panel {
		padding: 20px 14px 36px;
		border-radius: 0;
	}

	.rs-aff-panel__ranges {
		width: 100%;
	}

	.rs-aff-panel__range {
		flex: 1 1 auto;
		justify-content: center;
		padding: 8px 10px;
		font-size: 0.8rem;
	}

	.rs-aff-panel__table thead {
		display: none;
	}

	.rs-aff-panel__table tr {
		display: block;
		padding: 14px 16px;
		border-bottom: 1px solid var(--rs-aff-line);
	}

	.rs-aff-panel__table tr:last-child {
		border-bottom: 0;
	}

	.rs-aff-panel__table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: 12px;
		padding: 6px 0;
		border: 0;
	}

	.rs-aff-panel__table td::before {
		content: attr(data-label);
		flex: 0 0 auto;
		font-size: 0.72rem;
		font-weight: 700;
		letter-spacing: 0.05em;
		text-transform: uppercase;
		color: var(--rs-aff-muted);
	}

	.rs-aff-panel__table td[data-label=""]::before {
		content: none;
	}

	.rs-aff-panel__link-cell {
		flex-direction: column;
		align-items: stretch;
	}

	.rs-aff-panel__share-input {
		max-width: none;
	}

	.rs-aff-panel__action-cell {
		justify-content: flex-end;
		width: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rs-aff-panel__kpis {
		animation: none;
	}

	.rs-aff-panel__range,
	.rs-aff-panel__copy {
		transition: none;
	}
}
