.wft-wrap {
	--wft-primary: #2d6a4f;
	--wft-primary-dark: #1b4332;
	--wft-border: #d8dee2;
	--wft-surface: #ffffff;
	--wft-text: #1f2430;
	--wft-text-muted: #6b7280;
	--wft-danger: #b3261e;

	max-width: 100%;
	color: var(--wft-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	box-sizing: border-box;
}

.wft-wrap *, .wft-wrap *::before, .wft-wrap *::after {
	box-sizing: border-box;
}

.wft-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 16px;
}

.wft-title {
	margin: 0;
	font-size: 1.4em;
}

.wft-btn {
	padding: 8px 16px;
	border: 1px solid var(--wft-border);
	border-radius: 6px;
	background: var(--wft-surface);
	color: var(--wft-text);
	cursor: pointer;
	font-size: 0.95em;
}

.wft-btn-primary {
	background: var(--wft-primary);
	border-color: var(--wft-primary);
	color: #fff;
}

.wft-btn-primary:hover {
	background: var(--wft-primary-dark);
}

.wft-btn-danger {
	background: #fff;
	border-color: var(--wft-danger);
	color: var(--wft-danger);
}

.wft-notice {
	padding: 12px 16px;
	border: 1px solid var(--wft-border);
	border-radius: 6px;
	background: #f8f9fa;
	color: var(--wft-text-muted);
}

.wft-tree-canvas {
	overflow-x: auto;
	padding-bottom: 8px;
}

.wft-generation-row {
	margin-bottom: 24px;
}

.wft-generation-label {
	font-size: 0.8em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--wft-text-muted);
	margin-bottom: 8px;
}

.wft-generation-cards {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.wft-person-card {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 220px;
	padding: 10px;
	border: 1px solid var(--wft-border);
	border-radius: 8px;
	background: var(--wft-surface);
	cursor: pointer;
	transition: box-shadow 0.15s ease;
}

.wft-person-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wft-card-photo {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	background: #f0f2f5;
}

.wft-card-photo-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.4em;
}

.wft-card-body {
	min-width: 0;
}

.wft-card-name {
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wft-card-lifespan,
.wft-card-spouse {
	font-size: 0.8em;
	color: var(--wft-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ---------------- Modal ---------------- */

/* The [hidden] attribute is how family-tree.js shows/hides this modal
   (toggling the DOM attribute, never inline style="display:..."). Browsers
   apply `[hidden]{display:none}` via their own UA stylesheet, but that
   rule and `.wft-modal{display:flex}` below have EQUAL selector
   specificity (0,0,1,0 each) -- so whichever rule is later in the
   cascade wins, and this plugin's own stylesheet, loading after the
   browser's built-in UA styles, would otherwise always beat it and force
   the modal permanently visible regardless of the [hidden] attribute.
   This explicit rule, combined with :not([hidden]) below instead of a
   bare .wft-modal display rule, removes the ambiguity entirely rather
   than relying on cascade order. */
.wft-modal[hidden] {
	display: none;
}

.wft-modal:not([hidden]) {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 24px 16px;
	overflow-y: auto;
	z-index: 100000;
}

.wft-modal-inner {
	background: var(--wft-surface);
	border-radius: 10px;
	padding: 24px;
	width: 100%;
	max-width: 480px;
	color: var(--wft-text);
}

.wft-field {
	display: block;
	margin-bottom: 12px;
}

.wft-field span {
	display: block;
	font-size: 0.85em;
	margin-bottom: 4px;
	color: var(--wft-text-muted);
}

.wft-field input[type="text"],
.wft-field input[type="file"],
.wft-field select,
.wft-field textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--wft-border);
	border-radius: 6px;
	font-size: 0.95em;
	font-family: inherit;
}

.wft-field-row {
	display: flex;
	gap: 10px;
}

.wft-field-row .wft-field {
	flex: 1;
	min-width: 0;
}

.wft-photo-preview {
	margin-top: 8px;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	object-fit: cover;
}

.wft-modal-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
}

.wft-modal-spacer {
	flex: 1;
}

.wft-form-status {
	margin-top: 10px;
	font-size: 0.85em;
	color: var(--wft-text-muted);
}

@media (max-width: 480px) {
	.wft-field-row {
		flex-direction: column;
	}

	.wft-person-card {
		width: 100%;
	}
}

/* ---------------- Widget (loaded site-wide, not just on the shortcode page) ---------------- */

.wft-widget-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wft-widget-item a {
	display: block;
	padding: 6px 0;
	text-decoration: none;
}

.wft-widget-notice {
	font-size: 0.9em;
	opacity: 0.8;
}
