.ffup-portal {
	--ffup-primary: #2271b1;
	--ffup-primary-dark: #135e96;
	--ffup-text: #1e293b;
	--ffup-text-muted: #64748b;
	--ffup-surface: #ffffff;
	--ffup-surface-muted: #f8fafc;
	--ffup-border: #e2e8f0;
	--ffup-danger: #b32d2e;
	--ffup-danger-bg: #fbeaea;
	--ffup-danger-border: #e5a3a3;
	--ffup-radius: 12px;
	--ffup-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);

	max-width: 1200px;
	margin: 0 auto;
	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ffup-text);
	box-sizing: border-box;
}

.ffup-portal button,
.ffup-portal input {
	font-family: inherit;
}

.ffup-portal *,
.ffup-portal *::before,
.ffup-portal *::after {
	box-sizing: inherit;
}

@media (prefers-color-scheme: dark) {
	.ffup-portal {
		--ffup-text: #e2e8f0;
		--ffup-text-muted: #94a3b8;
		--ffup-surface: #1e293b;
		--ffup-surface-muted: #0f172a;
		--ffup-border: #334155;
	}
}

.ffup-portal :focus-visible {
	outline: 2px solid var(--ffup-primary);
	outline-offset: 2px;
}

/* Error / alert banner */
.ffup-portal .ffup-error {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--ffup-danger);
	background: var(--ffup-danger-bg);
	border: 1px solid var(--ffup-danger-border);
	padding: 10px 14px;
	border-radius: 8px;
	margin: 0 0 16px;
	font-size: 14px;
}

.ffup-error-icon {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
}

.ffup-error-icon svg {
	width: 100%;
	height: 100%;
}

/* Login card */
.ffup-login {
	max-width: 360px;
	padding: 32px 28px;
	background: var(--ffup-surface);
	border: 1px solid var(--ffup-border);
	border-radius: var(--ffup-radius);
	box-shadow: var(--ffup-shadow);
	text-align: center;
}

.ffup-login-icon {
	width: 44px;
	height: 44px;
	margin: 0 auto 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--ffup-surface-muted);
	color: var(--ffup-primary);
}

.ffup-login-icon svg {
	width: 20px;
	height: 20px;
}

.ffup-login-title {
	margin: 0 0 6px;
	font-size: 20px;
	font-weight: 600;
}

.ffup-login-subtitle {
	margin: 0 0 20px;
	color: var(--ffup-text-muted);
	font-size: 14px;
}

.ffup-login-form {
	text-align: left;
}

.ffup-field {
	margin: 0 0 16px;
}

.ffup-login-form label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 14px;
}

.ffup-login-form input[type="text"],
.ffup-login-form input[type="password"] {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	font-size: 16px;
	border: 1px solid var(--ffup-border);
	border-radius: 8px;
	background: var(--ffup-surface);
	color: var(--ffup-text);
	transition: border-color 150ms ease;
}

.ffup-login-form input:focus {
	border-color: var(--ffup-primary);
}

.ffup-password-wrap {
	position: relative;
	display: block;
}

.ffup-password-wrap input {
	padding-right: 44px;
}

.ffup-password-toggle {
	position: absolute;
	top: 0;
	right: 0;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: var(--ffup-text-muted);
	cursor: pointer;
}

.ffup-password-toggle svg {
	width: 18px;
	height: 18px;
}

.ffup-submit {
	width: 100%;
	min-height: 44px;
	padding: 10px 18px;
	border: none;
	border-radius: 8px;
	background: var(--ffup-primary);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 150ms ease;
}

.ffup-submit:hover {
	background: var(--ffup-primary-dark);
}

.ffup-submit.is-loading {
	color: transparent;
	position: relative;
	pointer-events: none;
}

.ffup-submit.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ffup-spin 700ms linear infinite;
}

@media (prefers-reduced-motion: reduce) {
	.ffup-submit.is-loading::after {
		animation-duration: 1400ms;
	}
}

@keyframes ffup-spin {
	to {
		transform: rotate(360deg);
	}
}

.ffup-lost-password {
	margin: 16px 0 0;
	text-align: center;
	font-size: 14px;
}

.ffup-lost-password a {
	color: var(--ffup-primary);
}

/* Dashboard header */
.ffup-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--ffup-border);
}

.ffup-identity {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.ffup-avatar {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--ffup-primary);
	color: #fff;
	font-weight: 600;
	font-size: 14px;
}

.ffup-identity-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ffup-greeting {
	font-size: 12px;
	color: var(--ffup-text-muted);
}

.ffup-username {
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ffup-logout {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 14px;
	border-radius: 8px;
	color: var(--ffup-text);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: background 150ms ease;
}

.ffup-logout:hover {
	background: var(--ffup-surface-muted);
}

.ffup-icon-logout svg {
	width: 16px;
	height: 16px;
}

/* Empty state */
.ffup-empty {
	text-align: center;
	padding: 48px 24px;
	border: 1px dashed var(--ffup-border);
	border-radius: var(--ffup-radius);
	color: var(--ffup-text-muted);
}

.ffup-empty-icon {
	display: inline-block;
	width: 48px;
	height: 48px;
	margin-bottom: 12px;
	color: var(--ffup-text-muted);
}

.ffup-empty-icon svg {
	width: 100%;
	height: 100%;
}

.ffup-empty-title {
	margin: 0 0 4px;
	font-weight: 600;
	color: var(--ffup-text);
}

.ffup-empty-text {
	margin: 0;
	font-size: 14px;
}

/* Toolbar / search */
.ffup-toolbar {
	margin-bottom: 16px;
}

.ffup-search {
	position: relative;
	display: block;
}

.ffup-icon-search {
	position: absolute;
	top: 50%;
	left: 12px;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	color: var(--ffup-text-muted);
	pointer-events: none;
}

.ffup-icon-search svg {
	width: 100%;
	height: 100%;
}

.ffup-search input {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px 8px 38px;
	font-size: 15px;
	border: 1px solid var(--ffup-border);
	border-radius: 8px;
	background: var(--ffup-surface);
	color: var(--ffup-text);
}

.ffup-search input:focus {
	border-color: var(--ffup-primary);
}

.ffup-no-results {
	text-align: center;
	color: var(--ffup-text-muted);
	padding: 24px 0;
}

/* Form group cards */
.ffup-groups {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.ffup-form-group {
	padding: 16px 20px 20px;
	background: var(--ffup-surface);
	border: 1px solid var(--ffup-border);
	border-radius: var(--ffup-radius);
	box-shadow: var(--ffup-shadow);
}

.ffup-form-group-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 12px;
	font-size: 16px;
	font-weight: 600;
}

.ffup-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--ffup-surface-muted);
	color: var(--ffup-text-muted);
	font-size: 12px;
	font-weight: 600;
}

.ffup-table {
	width: 100%;
	border-collapse: collapse;
}

.ffup-table th,
.ffup-table td {
	text-align: left;
	padding: 10px 8px;
	border-bottom: 1px solid var(--ffup-border);
	vertical-align: top;
}

.ffup-table thead th {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--ffup-text-muted);
	font-weight: 600;
}

.ffup-table tbody tr:last-child th,
.ffup-table tbody tr:last-child td {
	border-bottom: none;
}

.ffup-show-more {
	margin-top: 12px;
	padding: 8px 14px;
	min-height: 36px;
	background: var(--ffup-surface-muted);
	border: 1px solid var(--ffup-border);
	border-radius: 8px;
	color: var(--ffup-text);
	font-size: 14px;
	cursor: pointer;
}

.ffup-show-more:hover {
	background: var(--ffup-border);
}

/* Expandable details */
.ffup-portal details summary {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	color: var(--ffup-primary);
	font-weight: 500;
	list-style: none;
}

.ffup-portal details summary::-webkit-details-marker {
	display: none;
}

.ffup-chevron {
	display: inline-flex;
	width: 14px;
	height: 14px;
	transition: transform 200ms ease;
}

.ffup-chevron svg {
	width: 100%;
	height: 100%;
}

.ffup-portal details[open] .ffup-chevron {
	transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
	.ffup-chevron {
		transition: none;
	}
}

.ffup-fields {
	margin: 12px 0 0;
	padding: 12px;
	background: var(--ffup-surface-muted);
	border-radius: 8px;
}

.ffup-field-row {
	display: grid;
	grid-template-columns: minmax(120px, 35%) 1fr;
	gap: 4px 12px;
	padding: 6px 0;
}

.ffup-field-row:not(:last-child) {
	border-bottom: 1px solid var(--ffup-border);
}

.ffup-fields dt {
	color: var(--ffup-text-muted);
	font-size: 13px;
	font-weight: 600;
}

.ffup-fields dd {
	margin: 0;
	word-break: break-word;
}

@media (max-width: 480px) {
	.ffup-field-row {
		grid-template-columns: 1fr;
	}
}
