/**
 * AfriDirect Payment - admin design system.
 *
 * Loaded only on the plugin's own admin screens. Everything is scoped under
 * body.afd-admin (added via admin_body_class) so nothing leaks into other
 * WordPress screens.
 *
 * @package AfriDirect_Payment
 */

/* ---------------------------------------------------------------------------
 * 1. Tokens
 * ------------------------------------------------------------------------- */
body.afd-admin {
	--afd-primary: #1f7a3d;
	--afd-primary-hover: #19652f;
	--afd-primary-soft: #e8f4ec;
	--afd-accent: #a3392b;
	--afd-accent-soft: #fcefec;
	--afd-ink: #1d2433;
	--afd-muted: #5b6475;
	--afd-line: #e5e8ee;
	--afd-bg: #f5f6f8;
	--afd-card: #ffffff;
	--afd-radius: 14px;
	--afd-radius-sm: 10px;
	--afd-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
	--afd-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	background: var(--afd-bg);
}

body.afd-admin #wpcontent {
	padding-left: 0;
}

body.afd-admin #wpbody-content {
	box-sizing: border-box;
	padding: 0 24px 40px;
	font-family: var(--afd-font);
	color: var(--afd-ink);
}

body.afd-admin #wpfooter {
	padding-left: 24px;
}

/* ---------------------------------------------------------------------------
 * 2. Header + navigation
 * ------------------------------------------------------------------------- */
.afd-header {
	background: var(--afd-card);
	border-bottom: 1px solid var(--afd-line);
	font-family: var(--afd-font);
}

.afd-header__inner {
	display: flex;
	align-items: center;
	gap: 28px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 12px 24px;
}

.afd-brand {
	display: inline-flex;
	flex: none;
	line-height: 0;
	border-radius: 8px;
}

.afd-brand img {
	display: block;
	height: 40px;
	width: auto;
}

.afd-nav {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 4px;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.afd-nav::-webkit-scrollbar {
	display: none;
}

.afd-nav__link {
	flex: none;
	padding: 9px 14px;
	border-radius: 999px;
	color: var(--afd-muted);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.afd-nav__link:hover {
	background: #f1f3f6;
	color: var(--afd-ink);
}

.afd-nav__link.is-active {
	background: var(--afd-primary-soft);
	color: var(--afd-primary);
}

.afd-version {
	flex: none;
	padding: 4px 10px;
	border: 1px solid var(--afd-line);
	border-radius: 999px;
	color: var(--afd-muted);
	font-size: 12px;
	font-weight: 600;
}

.afd-header a:focus-visible,
.afd-page a:focus-visible,
.afd-btn:focus-visible,
.afd-switch input:focus-visible + .afd-switch__track {
	outline: 2px solid var(--afd-primary);
	outline-offset: 2px;
	box-shadow: none;
}

/* ---------------------------------------------------------------------------
 * 3. Page layout
 * ------------------------------------------------------------------------- */
.afd-page {
	max-width: 1232px;
	margin: 0 auto;
	padding-top: 24px;
}

.afd-page__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
}

.afd-title {
	margin: 0;
	padding: 0;
	color: var(--afd-ink);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.25;
}

.afd-subtitle {
	margin: 6px 0 0;
	max-width: 62ch;
	color: var(--afd-muted);
	font-size: 14px;
	line-height: 1.5;
}

.afd-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.afd-grid {
	display: grid;
	gap: 20px;
	margin-bottom: 20px;
}

.afd-grid--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.afd-grid--3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.afd-grid--main {
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	align-items: start;
}

.afd-how__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	margin-bottom: 12px;
	border-radius: 50%;
	background: var(--afd-accent-soft);
	color: var(--afd-accent);
	font-size: 14px;
	font-weight: 700;
}

.afd-how__title {
	margin: 0 0 6px;
	padding: 0;
	font-size: 15px;
	font-weight: 700;
}

.afd-stack {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ---------------------------------------------------------------------------
 * 4. Cards
 * ------------------------------------------------------------------------- */
.afd-card {
	background: var(--afd-card);
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	box-shadow: var(--afd-shadow);
}

.afd-card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 22px;
	border-bottom: 1px solid var(--afd-line);
}

.afd-card__title {
	margin: 0;
	padding: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.afd-card__desc {
	margin: 4px 0 0;
	color: var(--afd-muted);
	font-size: 13px;
	line-height: 1.5;
}

.afd-card__body {
	padding: 22px;
}

.afd-card__body--flush {
	padding: 0;
}

.afd-card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 16px 22px;
	border-top: 1px solid var(--afd-line);
	background: #fafbfc;
	border-radius: 0 0 var(--afd-radius) var(--afd-radius);
}

.afd-card--accent {
	background: var(--afd-accent-soft);
	border-color: #f3d3cd;
}

.afd-card--success {
	background: var(--afd-primary-soft);
	border-color: #cfe6d7;
}

/* ---------------------------------------------------------------------------
 * 5. Buttons
 * ------------------------------------------------------------------------- */
.afd-btn,
body.afd-admin .wrap .page-title-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 18px;
	border: 1px solid var(--afd-line);
	border-radius: 10px;
	background: var(--afd-card);
	color: var(--afd-ink);
	font-family: var(--afd-font);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.afd-btn:hover,
body.afd-admin .wrap .page-title-action:hover {
	border-color: #c9ced8;
	background: #f7f8fa;
	color: var(--afd-ink);
}

.afd-btn--primary {
	border-color: var(--afd-primary);
	background: var(--afd-primary);
	color: #fff;
}

.afd-btn--primary:hover {
	border-color: var(--afd-primary-hover);
	background: var(--afd-primary-hover);
	color: #fff;
}

.afd-btn--danger {
	border-color: #f0c9c3;
	background: #fff;
	color: #a3281b;
}

.afd-btn--danger:hover {
	border-color: #e5a69d;
	background: #fdf2f0;
	color: #8c2217;
}

.afd-btn--sm {
	min-height: 32px;
	padding: 0 12px;
	border-radius: 8px;
	font-size: 13px;
}

.afd-btn--link {
	min-height: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--afd-primary);
}

.afd-btn--link:hover {
	background: none;
	color: var(--afd-primary-hover);
	text-decoration: underline;
}

.afd-btn[disabled],
.afd-btn.is-disabled {
	opacity: 0.55;
	pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * 6. Status pills
 * ------------------------------------------------------------------------- */
.afd-pill,
body.afd-admin .afridirect-status-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: #eceff3;
	color: #4b5565;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0;
	line-height: 1.2;
	text-transform: none;
	white-space: nowrap;
}

.afd-pill::before,
body.afd-admin .afridirect-status-badge::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

.afd-pill--review,
body.afd-admin .afridirect-status-needs_review,
body.afd-admin .afridirect-status-adp-proof,
body.afd-admin .afridirect-status-on-hold {
	background: #fff4d6;
	color: #8a5a00;
}

.afd-pill--approved,
body.afd-admin .afridirect-status-approved,
body.afd-admin .afridirect-status-processing,
body.afd-admin .afridirect-status-completed {
	background: #e3f3e8;
	color: #17663a;
}

.afd-pill--rejected,
body.afd-admin .afridirect-status-rejected,
body.afd-admin .afridirect-status-failed {
	background: #fde8e5;
	color: #a3281b;
}

.afd-pill--pending,
body.afd-admin .afridirect-status-pending_proof,
body.afd-admin .afridirect-status-adp-pending,
body.afd-admin .afridirect-status-pending {
	background: #eaf0fb;
	color: #284b8c;
}

/* ---------------------------------------------------------------------------
 * 7. Stat tiles
 * ------------------------------------------------------------------------- */
.afd-stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
	margin-bottom: 20px;
}

.afd-stat {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 20px 22px;
	background: var(--afd-card);
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	box-shadow: var(--afd-shadow);
	color: inherit;
	text-decoration: none;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

a.afd-stat:hover {
	border-color: #c9ced8;
	transform: translateY(-1px);
	color: inherit;
}

.afd-stat__label {
	color: var(--afd-muted);
	font-size: 13px;
	font-weight: 600;
}

.afd-stat__value {
	font-size: 32px;
	font-weight: 700;
	line-height: 1.1;
}

.afd-stat__hint {
	color: var(--afd-muted);
	font-size: 12px;
}

.afd-stat--alert {
	border-color: #f3d9a4;
	background: #fffaf0;
}

.afd-stat--alert .afd-stat__value {
	color: #8a5a00;
}

/* Payments overview: money tiles with a period / currency filter. */
.afd-money-bar {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 12px;
}

.afd-money-bar__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
}

.afd-money-bar__note {
	margin: 4px 0 0;
	color: var(--afd-muted);
	font-size: 12px;
}

.afd-money-filters {
	display: flex;
	align-items: center;
	gap: 8px;
}

body.afd-admin .afd-money-filters .afd-select {
	min-width: 120px;
	min-height: 36px;
	padding: 0 32px 0 12px;
	border: 1px solid var(--afd-line);
	border-radius: 10px;
	background-color: var(--afd-card);
	color: var(--afd-ink);
	font-size: 13px;
	font-weight: 600;
}

.afd-money {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
	margin-bottom: 20px;
}

.afd-money__tile {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 20px 22px;
	background: var(--afd-card);
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	box-shadow: var(--afd-shadow);
}

.afd-money__label {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--afd-muted);
	font-size: 13px;
	font-weight: 600;
}

.afd-money__icon {
	display: inline-flex;
	width: 18px;
	height: 18px;
}

.afd-money__icon svg {
	width: 18px;
	height: 18px;
}

.afd-money__icon--green {
	color: var(--afd-primary);
}

.afd-money__icon--amber {
	color: #c58a00;
}

.afd-money__icon--purple {
	color: #6d4fd8;
}

.afd-money__value {
	font-size: 30px;
	font-weight: 700;
	line-height: 1.15;
	word-break: break-word;
}

.afd-money__hint {
	color: var(--afd-muted);
	font-size: 12px;
}

.afd-tip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #e3e6ec;
	color: var(--afd-muted);
	font-size: 11px;
	font-weight: 700;
	cursor: help;
}

.afd-tip:focus-visible {
	outline: 2px solid var(--afd-primary);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
 * 8. Setup checklist
 * ------------------------------------------------------------------------- */
.afd-progress {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 180px;
}

.afd-progress__bar {
	flex: 1;
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: #e9ecf1;
}

.afd-progress__fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--afd-primary);
	transition: width 0.4s ease;
}

.afd-progress__text {
	color: var(--afd-muted);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.afd-steps {
	margin: 0;
	padding: 0;
	list-style: none;
}

.afd-step {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px 22px;
	border-bottom: 1px solid var(--afd-line);
}

.afd-step:last-child {
	border-bottom: 0;
}

.afd-step__icon {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 2px solid #d5d9e1;
	border-radius: 50%;
	color: var(--afd-muted);
	font-size: 14px;
	font-weight: 700;
}

.afd-step.is-done .afd-step__icon {
	border-color: var(--afd-primary);
	background: var(--afd-primary);
	color: #fff;
}

.afd-step__text {
	flex: 1;
	min-width: 0;
}

.afd-step__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
}

.afd-step.is-done .afd-step__title {
	color: var(--afd-muted);
	font-weight: 600;
	text-decoration: line-through;
	text-decoration-color: #b9c0cc;
}

.afd-step__desc {
	margin: 3px 0 0;
	color: var(--afd-muted);
	font-size: 13px;
	line-height: 1.5;
}

/* ---------------------------------------------------------------------------
 * 9. Lists and rows
 * ------------------------------------------------------------------------- */
.afd-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.afd-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px 22px;
	border-bottom: 1px solid var(--afd-line);
}

.afd-row:last-child {
	border-bottom: 0;
}

.afd-row__main {
	flex: 1;
	min-width: 0;
}

.afd-row__title {
	margin: 0;
	overflow: hidden;
	font-size: 14px;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.afd-row__meta {
	margin: 2px 0 0;
	overflow: hidden;
	color: var(--afd-muted);
	font-size: 13px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.afd-row__side {
	display: flex;
	flex: none;
	align-items: center;
	gap: 12px;
}

.afd-amount {
	font-size: 14px;
	font-weight: 700;
}

/* Code chip (shortcodes) with copy button. */
.afd-code {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	padding: 6px 10px;
	border: 1px solid var(--afd-line);
	border-radius: 8px;
	background: #f6f7f9;
	color: var(--afd-ink);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------------------------------------------------------------------------
 * 10. Payment method cards
 * ------------------------------------------------------------------------- */
.afd-method-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
	gap: 20px;
}

.afd-method {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 20px;
	background: var(--afd-card);
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	box-shadow: var(--afd-shadow);
}

.afd-method__top {
	display: flex;
	align-items: center;
	gap: 14px;
}

.afd-icon {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: var(--afd-primary-soft);
	color: var(--afd-primary);
}

.afd-icon svg {
	width: 22px;
	height: 22px;
}

.afd-method__name {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.afd-method__type {
	margin: 2px 0 0;
	color: var(--afd-muted);
	font-size: 13px;
}

.afd-method__detail {
	margin: 0;
	padding: 10px 12px;
	overflow: hidden;
	border-radius: 10px;
	background: #f6f7f9;
	color: var(--afd-ink);
	font-size: 13px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.afd-method__detail--empty {
	background: #fff6e5;
	color: #8a5a00;
	white-space: normal;
}

.afd-method__foot {
	display: flex;
	gap: 8px;
	margin-top: auto;
}

/* ---------------------------------------------------------------------------
 * 11. Empty state
 * ------------------------------------------------------------------------- */
.afd-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 48px 24px;
	text-align: center;
}

.afd-empty .afd-icon {
	width: 56px;
	height: 56px;
	margin-bottom: 6px;
	border-radius: 16px;
}

.afd-empty .afd-icon svg {
	width: 28px;
	height: 28px;
}

.afd-empty__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
}

.afd-empty__text {
	margin: 0 0 10px;
	max-width: 46ch;
	color: var(--afd-muted);
	font-size: 14px;
	line-height: 1.55;
}

/* ---------------------------------------------------------------------------
 * 12. Settings layout, fields and toggle
 * ------------------------------------------------------------------------- */
.afd-settings {
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

.afd-side {
	position: sticky;
	top: 48px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px;
	background: var(--afd-card);
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	box-shadow: var(--afd-shadow);
}

.afd-side__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 12px;
	border-radius: 10px;
	color: var(--afd-muted);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.afd-side__link:hover {
	background: #f1f3f6;
	color: var(--afd-ink);
}

.afd-side__link.is-active {
	background: var(--afd-accent-soft);
	color: var(--afd-accent);
}

.afd-side__link svg {
	width: 18px;
	height: 18px;
	flex: none;
}

.afd-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 20px;
}

.afd-field:last-child {
	margin-bottom: 0;
}

.afd-label {
	color: var(--afd-ink);
	font-size: 14px;
	font-weight: 700;
}

.afd-help {
	margin: 0;
	color: var(--afd-muted);
	font-size: 13px;
	line-height: 1.5;
}

.afd-field input[type="text"],
.afd-field input[type="email"],
.afd-field select,
.afd-field textarea {
	box-sizing: border-box;
	width: 100%;
	max-width: 560px;
	min-height: 42px;
	padding: 9px 12px;
	border: 1px solid #cdd2dc;
	border-radius: 10px;
	background: #fff;
	color: var(--afd-ink);
	font-family: var(--afd-font);
	font-size: 14px;
	line-height: 1.4;
	box-shadow: none;
}

.afd-field textarea {
	min-height: 96px;
	resize: vertical;
}

.afd-field input:focus,
.afd-field select:focus,
.afd-field textarea:focus {
	border-color: var(--afd-primary);
	outline: 2px solid var(--afd-primary-soft);
	box-shadow: none;
}

.afd-toggle-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	padding-bottom: 20px;
	margin-bottom: 20px;
	border-bottom: 1px solid var(--afd-line);
}

.afd-toggle-row:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: 0;
}

.afd-switch {
	position: relative;
	display: inline-block;
	flex: none;
	width: 46px;
	height: 26px;
}

.afd-switch input {
	position: absolute;
	inset: 0;
	z-index: 1;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.afd-switch__track {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: #c3c9d4;
	transition: background-color 0.2s ease;
}

.afd-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(16, 24, 40, 0.3);
	transition: transform 0.2s ease;
}

.afd-switch input:checked + .afd-switch__track {
	background: var(--afd-primary);
}

.afd-switch input:checked + .afd-switch__track::after {
	transform: translateX(20px);
}

.afd-panel[hidden] {
	display: none;
}

/* ---------------------------------------------------------------------------
 * 13. Toast / inline notice (our own screens only)
 * ------------------------------------------------------------------------- */
.afd-toast {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 20px;
	padding: 14px 18px;
	border: 1px solid #cfe6d7;
	border-radius: var(--afd-radius-sm);
	background: var(--afd-primary-soft);
	color: #14532d;
	font-size: 14px;
	font-weight: 600;
}

.afd-toast--warn {
	border-color: #f3d9a4;
	background: #fff6e5;
	color: #7a4e00;
}

.afd-notice-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
}

.afd-notice-row p {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
}

/* ---------------------------------------------------------------------------
 * 14. Tables (our list pages + core list tables on our screens)
 * ------------------------------------------------------------------------- */
.afd-table-wrap {
	overflow-x: auto;
	background: var(--afd-card);
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	box-shadow: var(--afd-shadow);
}

body.afd-admin .afd-table-wrap .wp-list-table {
	margin: 0;
	border: 0;
	box-shadow: none;
}

body.afd-admin .wp-list-table {
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	overflow: hidden;
	box-shadow: var(--afd-shadow);
}

body.afd-admin .wp-list-table thead th,
body.afd-admin .wp-list-table tfoot th {
	padding: 12px 16px;
	border-bottom: 1px solid var(--afd-line);
	background: #f8f9fb;
	color: var(--afd-muted);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

body.afd-admin .wp-list-table tbody td,
body.afd-admin .wp-list-table tbody th {
	padding: 14px 16px;
	vertical-align: middle;
}

body.afd-admin .wp-list-table.striped > tbody > :nth-child(odd) {
	background: transparent;
}

body.afd-admin .wp-list-table tbody tr:hover {
	background: #fafbfc;
}

body.afd-admin .afridirect-meta {
	color: var(--afd-muted);
}

/* Column widths for our two payment lists (fixed table layout). */
body.afd-admin .afridirect-payments-table .column-reference {
	width: 24%;
}

body.afd-admin .afridirect-payments-table .column-amount {
	width: 12%;
}

body.afd-admin .afridirect-payments-table .column-actions {
	width: 10%;
}

body.afd-admin .afridirect-woo-payments-table .column-order-id {
	width: 7%;
}

body.afd-admin .afridirect-woo-payments-table .column-customer {
	width: 17%;
	word-break: break-word;
}

body.afd-admin .afridirect-woo-payments-table .column-total {
	width: 8%;
}

body.afd-admin .afridirect-woo-payments-table .column-method {
	width: 13%;
	word-break: break-word;
}

body.afd-admin .afridirect-woo-payments-table .column-proof {
	width: 9%;
}

body.afd-admin .afridirect-woo-payments-table .column-date {
	width: 14%;
}

body.afd-admin .afridirect-woo-payments-table .column-status {
	width: 16%;
}

body.afd-admin .afridirect-woo-payments-table .column-actions {
	width: 16%;
}

/* Payment requests. */
.afd-pill--muted {
	background: #eef0f3;
	color: #4b5563;
}

.afd-rowactions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

body.afd-admin .afridirect-requests-table .column-request {
	width: 19%;
}

body.afd-admin .afridirect-requests-table .column-customer {
	width: 20%;
	word-break: break-word;
}

body.afd-admin .afridirect-requests-table .column-amount {
	width: 12%;
}

body.afd-admin .afridirect-requests-table .column-until {
	width: 13%;
}

body.afd-admin .afridirect-requests-table .column-status {
	width: 11%;
}

body.afd-admin .afridirect-requests-table .column-actions {
	width: 25%;
}

.afd-btn--danger-text,
.afd-btn--danger-text:hover {
	color: var(--afd-accent);
}

.afd-created {
	margin-bottom: 20px;
}

.afd-linkbox {
	display: flex;
	gap: 10px;
	margin-top: 12px;
}

body.afd-admin .afd-linkbox input[type="text"] {
	flex: 1;
	min-width: 0;
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--afd-line);
	border-radius: 10px;
	background: var(--afd-bg);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
}

.afd-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 20px;
}

.afd-check-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 10px;
}

.afd-check {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border: 1px solid var(--afd-line);
	border-radius: 10px;
	background: var(--afd-card);
	cursor: pointer;
}

.afd-check input {
	margin: 0;
}

.afd-field input[type="number"] {
	width: 100%;
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--afd-line);
	border-radius: 10px;
	background: var(--afd-card);
	color: var(--afd-ink);
	font-size: 14px;
}

.afd-field input[type="number"]:focus {
	border-color: var(--afd-primary);
	box-shadow: 0 0 0 3px rgba(31, 122, 61, 0.15);
	outline: none;
}

@media (max-width: 782px) {
	.afd-form-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.afd-linkbox {
		flex-direction: column;
	}
}

/* Status filter tabs ("subsubsub") become pills. */
body.afd-admin .subsubsub {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	float: none;
	margin: 0 0 18px;
	padding: 0;
}

body.afd-admin .subsubsub li {
	margin: 0;
	font-size: 0;
}

body.afd-admin .subsubsub a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--afd-line);
	border-radius: 999px;
	background: var(--afd-card);
	color: var(--afd-muted);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
}

body.afd-admin .subsubsub a:hover {
	border-color: #c9ced8;
	color: var(--afd-ink);
}

body.afd-admin .subsubsub a.current {
	border-color: var(--afd-primary);
	background: var(--afd-primary-soft);
	color: var(--afd-primary);
}

body.afd-admin .subsubsub .count {
	color: inherit;
	opacity: 0.8;
}

/* Core page titles on CPT screens. */
body.afd-admin .wrap {
	max-width: 1232px;
	margin: 24px auto 0;
}

body.afd-admin .wrap > h1,
body.afd-admin .wrap > h1.wp-heading-inline {
	margin-bottom: 4px;
	padding: 0;
	color: var(--afd-ink);
	font-family: var(--afd-font);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.25;
}

body.afd-admin .wrap .page-title-action {
	position: relative;
	top: -2px;
	margin-left: 12px;
	min-height: 34px;
	padding: 0 14px;
	border-color: var(--afd-primary);
	background: var(--afd-primary);
	color: #fff;
	font-size: 13px;
}

body.afd-admin .wrap .page-title-action:hover {
	border-color: var(--afd-primary-hover);
	background: var(--afd-primary-hover);
	color: #fff;
}

/* Meta boxes on the form / payment edit screens. */
body.afd-admin .postbox {
	border: 1px solid var(--afd-line);
	border-radius: var(--afd-radius);
	box-shadow: var(--afd-shadow);
}

body.afd-admin .postbox .postbox-header {
	border-bottom: 1px solid var(--afd-line);
	border-radius: var(--afd-radius) var(--afd-radius) 0 0;
}

body.afd-admin .postbox .hndle {
	font-family: var(--afd-font);
	font-size: 15px;
	font-weight: 700;
}

body.afd-admin .button-primary {
	border-color: var(--afd-primary);
	border-radius: 10px;
	background: var(--afd-primary);
	color: #fff;
}

body.afd-admin .button-primary:hover {
	border-color: var(--afd-primary-hover);
	background: var(--afd-primary-hover);
}

/* ---------------------------------------------------------------------------
 * 15. Responsive
 * ------------------------------------------------------------------------- */
@media (max-width: 1180px) {
	.afd-header__inner {
		flex-wrap: wrap;
		gap: 12px 20px;
	}

	.afd-nav {
		order: 3;
		flex: 1 1 100%;
		flex-wrap: wrap;
		overflow: visible;
	}

	.afd-version {
		margin-left: auto;
	}
}

@media (max-width: 1100px) {
	.afd-stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.afd-grid--main {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 900px) {
	.afd-settings {
		grid-template-columns: minmax(0, 1fr);
	}

	.afd-side {
		position: static;
		flex-direction: row;
		overflow-x: auto;
	}

	.afd-side__link {
		white-space: nowrap;
	}

	.afd-grid--2,
	.afd-grid--3 {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 782px) {
	/* Our header renders above #wpbody, so it must clear the mobile admin bar itself. */
	body.afd-admin #wpbody {
		padding-top: 0;
	}

	body.afd-admin #wpcontent {
		padding-top: 46px;
	}

	body.afd-admin #wpbody-content {
		padding: 0 14px 32px;
	}

	.afd-header__inner {
		flex-wrap: wrap;
		gap: 12px;
		padding: 12px 14px;
	}

	.afd-nav {
		order: 3;
		flex-basis: 100%;
	}

	.afd-version {
		margin-left: auto;
	}

	.afd-title {
		font-size: 22px;
	}

	.afd-row {
		flex-wrap: wrap;
	}

	.afd-row__side {
		width: 100%;
		justify-content: space-between;
	}

	.afd-step {
		flex-wrap: wrap;
	}

	/* Keep list tables as real tables and scroll them sideways inside their card. */
	body.afd-admin .afd-table-wrap .wp-list-table {
		display: table;
		min-width: 860px;
		table-layout: fixed;
	}

	body.afd-admin .afd-table-wrap .wp-list-table thead {
		display: table-header-group;
	}

	body.afd-admin .afd-table-wrap .wp-list-table tr {
		display: table-row;
	}

	body.afd-admin .afd-table-wrap .wp-list-table th,
	body.afd-admin .afd-table-wrap .wp-list-table td {
		display: table-cell;
		word-break: normal;
	}

	body.afd-admin .afd-table-wrap .wp-list-table td::before {
		display: none;
	}
}

@media (max-width: 782px) {
	.afd-money {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 520px) {
	.afd-stats {
		grid-template-columns: minmax(0, 1fr);
	}

	.afd-stat__value {
		font-size: 28px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.afd-btn,
	.afd-nav__link,
	.afd-stat,
	.afd-progress__fill,
	.afd-switch__track,
	.afd-switch__track::after {
		transition: none;
	}
}
