/*
 * Forms: join, dashboard, report, and the wp-admin club meta box.
 * RacerPacer light-theme tokens (brand/dist/tokens.json, color.theme.*). The site
 * theme sets the same names, so either can load first.
 */
:where(:root) {
	--rp-ground: #faf5f3;
	--rp-raised: #ffffff;
	--rp-chip: #f3e7e3;
	--rp-ink: #2c1b18;
	--rp-ink-soft: #5c443e;
	--rp-muted: #7a625b;
	--rp-rule: #e6d8d3;
	--rp-edge: #ac8981;
	--rp-accent: #c93f18;
	--rp-fill: #ff5630;
	--rp-on-fill: #3d0600;
	--rp-error: #93000a;
	--rp-error-bg: #ffdad6;
	--rp-ok: #001e2c;
	--rp-ok-bg: #c4e7ff;
	--rp-radius-field: 12px;
}

.rpc-form,
.rpc-join,
.rpc-report,
.rpc-dash,
.rpc-create,
.rpc-account-form,
.rpc-directory {
	color: var(--rp-ink);
}

.rpc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---- Fields ---- */
.rpc-field {
	display: block;
	margin: 0 0 18px;
}
.rpc-field > label,
.rpc-field > .rpc-label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 15px;
}
.rpc-optional {
	margin-left: 4px;
	font-weight: 400;
	font-size: 13px;
	color: var(--rp-muted);
}
.rpc-field input[type="text"],
.rpc-field input[type="email"],
.rpc-field input[type="url"],
.rpc-field input[type="password"],
.rpc-field input[type="search"],
.rpc-field input[type="time"],
.rpc-field select,
.rpc-field textarea {
	display: block;
	width: 100%;
	min-height: 46px;
	padding: 10px 14px;
	border: 1px solid var(--rp-edge);
	border-radius: var(--rp-radius-field);
	background: var(--rp-raised);
	color: var(--rp-ink);
	font: inherit;
	font-size: 16px;
	line-height: 1.4;
}
.rpc-field textarea {
	min-height: 120px;
	resize: vertical;
}
.rpc-field input:focus,
.rpc-field select:focus,
.rpc-field textarea:focus {
	outline: 3px solid var(--rp-accent);
	outline-offset: 1px;
	border-color: var(--rp-accent);
}
.rpc-field input[aria-invalid="true"],
.rpc-row.has-error input {
	border-color: var(--rp-error);
}
.rpc-field input[type="file"] {
	font: inherit;
	font-size: 15px;
	max-width: 100%;
}
.rpc-hint {
	margin: 6px 0 0;
	color: var(--rp-muted);
	font-size: 14px;
	line-height: 1.45;
}
.rpc-hint.is-ok {
	color: var(--rp-ok);
}
.rpc-hint.is-bad,
.rpc-field-error {
	color: var(--rp-error);
}
.rpc-field-error {
	margin: 6px 0 0;
	font-size: 14px;
	font-weight: 600;
}
.rpc-check label,
.rpc-radio {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-weight: 400;
	font-size: 15px;
	line-height: 1.45;
	cursor: pointer;
}
.rpc-radio {
	margin: 0 0 10px;
}
.rpc-check input,
.rpc-radio input {
	flex: none;
	width: 20px;
	height: 20px;
	margin: 1px 0 0;
	accent-color: var(--rp-accent);
}

.rpc-grid-2,
.rpc-grid-3 {
	display: grid;
	gap: 0 16px;
}
@media (min-width: 640px) {
	.rpc-grid-2 { grid-template-columns: 1fr 1fr; }
	.rpc-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.rpc-fieldset {
	margin: 0 0 22px;
	padding: 0;
	border: 0;
	min-width: 0;
}
.rpc-fieldset legend {
	margin-bottom: 10px;
	padding: 0;
	font-weight: 600;
	font-size: 15px;
}

.rpc-slug {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--rp-edge);
	border-radius: var(--rp-radius-field);
	background: var(--rp-raised);
	overflow: hidden;
}
.rpc-slug span {
	display: flex;
	align-items: center;
	padding: 0 4px 0 14px;
	color: var(--rp-muted);
	font-size: 15px;
	white-space: nowrap;
}
.rpc-field .rpc-slug input {
	flex: 1;
	min-width: 0;
	padding-left: 2px;
	border: 0;
	border-radius: 0;
}

/* ---- Buttons ---- */
.rpc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 10px 22px;
	border: 0;
	border-radius: 999px;
	font: inherit;
	font-weight: 600;
	font-size: 15px;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}
.rpc-btn .rpc-icon {
	width: 18px;
	height: 18px;
}
.rpc-btn-primary {
	background: var(--rp-fill);
	color: var(--rp-on-fill);
}
.rpc-btn-primary:hover {
	background: var(--rp-accent);
	color: var(--rp-raised);
}
.rpc-btn-secondary {
	background: var(--rp-raised);
	color: var(--rp-ink);
	box-shadow: inset 0 0 0 1px var(--rp-edge);
}
.rpc-btn-secondary:hover {
	background: var(--rp-chip);
}
.rpc-btn-danger {
	background: var(--rp-error);
	color: var(--rp-raised);
}
.rpc-btn-lg {
	min-height: 54px;
	padding: 14px 30px;
	font-size: 17px;
}
.rpc-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}
.rpc-btn:focus-visible,
.rpc-icon-btn:focus-visible {
	outline: 3px solid var(--rp-accent);
	outline-offset: 2px;
}
.rpc-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--rp-ink-soft);
	cursor: pointer;
}
.rpc-icon-btn:hover:not(:disabled) {
	background: var(--rp-chip);
	color: var(--rp-ink);
}
.rpc-icon-btn:disabled {
	opacity: 0.35;
	cursor: default;
}
.rpc-icon-btn .rpc-icon {
	width: 20px;
	height: 20px;
}

/* ---- Notices & cards ---- */
.rpc-notice {
	margin: 0 0 20px;
	padding: 14px 18px;
	border-radius: 14px;
	font-size: 15px;
	line-height: 1.45;
}
.rpc-notice-ok {
	background: var(--rp-ok-bg);
	color: var(--rp-ok);
}
.rpc-notice-error {
	background: var(--rp-error-bg);
	color: var(--rp-error);
}
.rpc-notice-info {
	background: var(--rp-chip);
	color: var(--rp-ink);
}
.rpc-card {
	margin: 0 0 24px;
	padding: 28px;
	border-radius: 24px;
	background: var(--rp-raised);
	box-shadow: inset 0 0 0 1px var(--rp-rule);
}
.rpc-card h2 {
	margin-top: 0;
}

/* ---- Repeaters ---- */
.rpc-rows {
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
}
.rpc-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
	margin: 0 0 12px;
	padding: 16px;
	border-radius: 16px;
	background: var(--rp-raised);
	box-shadow: inset 0 0 0 1px var(--rp-rule);
}
.rpc-row.has-error {
	box-shadow: inset 0 0 0 2px var(--rp-error);
}
.rpc-row > .rpc-field-error {
	grid-column: 1 / -1;
}
.rpc-row-fields {
	display: grid;
	gap: 0 12px;
}
.rpc-row-fields .rpc-field {
	margin-bottom: 10px;
}
@media (min-width: 720px) {
	.rpc-link-fields { grid-template-columns: 1fr 1.4fr; }
	.rpc-meet-fields { grid-template-columns: 1fr 1fr; }
}
.rpc-row-controls {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

/* ---- Logo ---- */
.rpc-logo-field {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: flex-start;
	margin-bottom: 8px;
}
.rpc-logo-current {
	flex: none;
	width: 96px;
	height: 96px;
	overflow: hidden;
	border-radius: 50%;
	background: var(--rp-chip);
	box-shadow: inset 0 0 0 1px var(--rp-rule);
}
.rpc-logo-shape-rounded {
	border-radius: 20px;
}
.rpc-logo-current img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.rpc-logo-current .rpc-monogram {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	font-size: 30px;
	font-weight: 600;
	color: var(--rp-ink-soft);
}
.rpc-logo-inputs {
	flex: 1;
	min-width: 240px;
}

/* ---- Socials ---- */
.rpc-socials {
	display: grid;
	gap: 0 16px;
	margin-bottom: 28px;
}
@media (min-width: 720px) {
	.rpc-socials { grid-template-columns: 1fr 1fr; }
}
.rpc-social > label {
	display: flex;
	align-items: center;
	gap: 8px;
}
.rpc-field-icon {
	width: 18px;
	height: 18px;
	color: var(--rp-ink-soft);
}

/* ---- Theme pickers ---- */
.rpc-presets {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: 10px;
}
.rpc-preset,
.rpc-choice {
	position: relative;
	cursor: pointer;
}
.rpc-preset input,
.rpc-choice input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.rpc-preset {
	display: block;
	padding: 8px;
	border-radius: 16px;
	background: var(--rp-raised);
	box-shadow: inset 0 0 0 1px var(--rp-rule);
	text-align: center;
}
.rpc-preset-swatch {
	display: flex;
	height: 44px;
	overflow: hidden;
	border-radius: 10px;
}
.rpc-preset-swatch span {
	flex: 1;
}
.rpc-preset-name {
	display: block;
	margin-top: 6px;
	font-size: 14px;
	font-weight: 600;
}
.rpc-preset:has(input:checked),
.rpc-choice:has(input:checked) span {
	box-shadow: inset 0 0 0 2px var(--rp-accent);
}
.rpc-preset:has(input:focus-visible),
.rpc-choice:has(input:focus-visible) span {
	outline: 3px solid var(--rp-accent);
	outline-offset: 2px;
}
.rpc-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.rpc-choice span {
	display: inline-flex;
	align-items: center;
	min-height: 42px;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--rp-raised);
	box-shadow: inset 0 0 0 1px var(--rp-edge);
	font-size: 15px;
}
.rpc-choice:has(input:checked) span {
	background: var(--rp-chip);
	font-weight: 600;
}
.rpc-accent {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
}
.rpc-accent[hidden] {
	display: none;
}
.rpc-accent input[type="color"] {
	width: 56px;
	height: 44px;
	padding: 2px;
	border: 1px solid var(--rp-edge);
	border-radius: 10px;
	background: var(--rp-raised);
}
.rpc-accent .rpc-hint {
	flex-basis: 100%;
}
.rpc-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.rpc-swatch {
	width: 30px;
	height: 30px;
	padding: 0;
	border: 2px solid var(--rp-raised);
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--rp-edge);
	cursor: pointer;
}

/* ---- Dashboard layout ---- */
.rpc-dash-head {
	margin-bottom: 18px;
}
.rpc-eyebrow {
	margin: 0 0 4px;
	color: var(--rp-muted);
	font-size: 13px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}
.rpc-dash-title {
	margin: 0;
}
.rpc-dash-url {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 6px 0 0;
	font-size: 15px;
}
.rpc-dash-url a {
	color: var(--rp-accent);
}
.rpc-status {
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--rp-chip);
	font-size: 13px;
	font-weight: 600;
}
.rpc-status-live {
	background: var(--rp-ok-bg);
	color: var(--rp-ok);
}
.rpc-status-suspended {
	background: var(--rp-error-bg);
	color: var(--rp-error);
}

.rpc-tabs {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	gap: 4px;
	margin: 0 -16px 20px;
	padding: 8px 16px;
	overflow-x: auto;
	background: var(--rp-ground);
	border-bottom: 1px solid var(--rp-rule);
	scrollbar-width: none;
}
.rpc-tabs a {
	flex: none;
	padding: 8px 14px;
	border-radius: 999px;
	color: var(--rp-ink-soft);
	font-weight: 600;
	font-size: 15px;
	text-decoration: none;
}
.rpc-tabs a:hover {
	background: var(--rp-chip);
	color: var(--rp-ink);
}
.rpc-tabs a.is-active {
	background: var(--rp-ink);
	color: var(--rp-ground);
}

.rpc-dash-body {
	display: grid;
	gap: 32px;
}
@media (min-width: 1040px) {
	.rpc-dash-body {
		grid-template-columns: minmax(0, 1fr) 380px;
		align-items: start;
	}
}
.rpc-panel[hidden] {
	display: none;
}
.rpc-panel-title {
	margin: 0 0 8px;
	font-size: 24px;
}
.rpc-panel .rpc-panel-title + .rpc-hint {
	margin-bottom: 16px;
}
.rpc-panel-title:focus {
	outline: none;
}
.rpc-sub {
	margin: 28px 0 10px;
	font-size: 18px;
}
.rpc-savebar {
	position: sticky;
	bottom: 0;
	z-index: 4;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 12px -16px 0;
	padding: 14px 16px;
	background: var(--rp-ground);
	border-top: 1px solid var(--rp-rule);
}
.rpc-savebar[hidden] {
	display: none;
}

.rpc-dash-preview {
	display: none;
}
@media (min-width: 1040px) {
	.rpc-dash-preview {
		display: block;
		position: sticky;
		top: 80px;
	}
}
.rpc-phone {
	height: min(760px, calc(100vh - 140px));
	padding: 10px;
	border-radius: 40px;
	background: var(--rp-ink);
}
.rpc-phone iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 30px;
	background: var(--rp-raised);
}
.rpc-preview-hint {
	text-align: center;
}

.rpc-copy {
	display: flex;
	gap: 8px;
}
.rpc-copy input {
	flex: 1;
	min-width: 0;
}
.rpc-qr-block {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: center;
	margin: 20px 0;
}
.rpc-qr {
	width: 200px;
	padding: 10px;
	border-radius: 16px;
	background: #ffffff;
	box-shadow: inset 0 0 0 1px var(--rp-rule);
}
.rpc-qr svg {
	display: block;
	width: 100%;
	height: auto;
}
.rpc-qr-block > div:last-child {
	flex: 1;
	min-width: 220px;
}
.rpc-list {
	padding-left: 20px;
}
.rpc-danger {
	margin-top: 40px;
	padding: 24px;
	border-radius: 20px;
	box-shadow: inset 0 0 0 1px var(--rp-error);
}
.rpc-danger .rpc-sub {
	margin-top: 0;
	color: var(--rp-error);
}

/* ---- Directory ---- */
.rpc-club-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 12px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}
.rpc-club-card[hidden] {
	display: none;
}
.rpc-club-card a {
	display: flex;
	align-items: center;
	gap: 14px;
	height: 100%;
	padding: 14px;
	border-radius: 18px;
	background: var(--rp-raised);
	box-shadow: inset 0 0 0 1px var(--rp-rule);
	color: var(--rp-ink);
	text-decoration: none;
}
.rpc-club-card a:hover {
	box-shadow: inset 0 0 0 2px var(--rp-accent);
}
.rpc-club-card-logo {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	overflow: hidden;
	border-radius: 50%;
	background: var(--card-accent);
	color: var(--card-on);
	font-weight: 600;
}
.rpc-club-card-logo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.rpc-club-card-name {
	display: block;
	font-weight: 600;
}
.rpc-club-card-place {
	display: block;
	color: var(--rp-muted);
	font-size: 14px;
}

/* ---- wp-admin meta box ---- */
.wp-admin .rpc-form {
	max-width: 900px;
}
.wp-admin .rpc-form .rpc-panel {
	padding: 8px 0 20px;
	border-bottom: 1px solid var(--rp-rule);
}
.wp-admin .rpc-form .rpc-panel-title {
	padding: 0;
	font-size: 18px;
}
