.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(1px);
	z-index: 10000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 8vh;
}

.modal-overlay.centered {
	align-items: center;
	padding-top: 0;
}

.modal-overlay.centered .modal {
	min-width: 350px;
}

.modal {
	background: #f5f5f5;
	border-radius: 8px;
	max-height: 80vh;
	border: 1px solid #ddd;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
	display: flex;
	flex-direction: column;
}

.modal.narrow {
	width: 450px;
}

.modal.medium {
	width: 650px;
}

.modal.wide {
	width: 1000px;
}

.modal h3 {
	color: #333;
	font-size: 18px;
	font-weight: 300;
	line-height: 1.4;
	padding: 10px 15px;
	margin: 0;
}

.modal-content {
	flex: 1;
	overflow-y: auto;
	padding: 10px 15px;
}

.modal-body {
	display: flex;
	flex: 1;
	min-height: 0;
}

.modal-tabs {
	display: flex;
	flex-direction: column;
	min-width: 200px;
}

.modal-tabs [data-tab] {
	display: block;
	padding: 12px 20px;
	font-size: 16px;
	color: #333;
}

.modal-tabs [data-tab].selected {
	background: #fff;
}

.modal-tabs + .modal-content {
	flex: 1;
	background: #fff;
	padding: 15px 20px;
	overflow-y: auto;
}

.modal-content [data-tab-content] {
	display: none;
}

.modal-content [data-tab-content].active {
	display: block;
}

.modal-footer {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	padding-top: 15px;
}

.modal.tabbed-content .modal-footer {
	background: #fff;
	margin: 0;
}

.modal-footer .button.secondary {
	background: #666;
}

.form .fields {
 	display: grid;
 	grid-template-columns: auto 1fr;
 	align-items: center;
	gap: 12px 15px;
}
	
.form .field.stacked {
	grid-template-columns: 1fr;
	gap: 5px;
}

.form label {
	font-size: 16px;
	color: #444;
	padding-right: 15px;
	white-space: nowrap;
}

.form input[type="text"],
.form input[type="password"],
.form select,
.form textarea {
	width: 100%;
	padding: 8px 12px;
	font-size: 16px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #fafafa;
	transition: border-color 0.2s, background 0.2s;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
	outline: none;
	border-color: #f25341;
	background: #fff;
}

.form input[type="text"].error {
	border-color: #ba0000;
	background: #fff5f5;
}

.form input[type="text"].valid {
	border-color: #00ba00;
	background: #f5fff5;
}

.form .error-message {
	padding: 10px 15px;
	margin-bottom: 15px;
	border: 1px solid #ba0000;
	background: #ba000022;
	border-radius: 4px;
	font-size: 14px;
}

.form .error-message.success {
	border-color: #00ba00;
	background: #00ba0022;
}

.form .error-message:empty {
	display: none;
}

.form h4 {
	font-size: 16px;
	margin: 20px 0 10px;
	color: #333;
}

.form h4:first-child {
	margin-top: 0;
}

.form p {
	font-size: 14px;
	color: #666;
	margin-bottom: 15px;
}

.form.loading {
	cursor: progress;
	position: relative;
}

.form.loading:before {
	content: '';
	position: absolute;
	z-index: 100;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: #fff9;
	border-radius: 4px;
}

.credentials-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
}

.credentials-table th,
.credentials-table td {
	padding: 8px 12px;
	text-align: left;
	border: 1px solid #e0e0e0;
}

.credentials-table thead tr {
	background: #f5f5f5;
}

.credentials-table th {
	color: #222;
	font-weight: 600;
}

.credentials-table tbody tr:hover {
	background: #fafafa;
}

.credentials-table .credential-checkbox {
	margin: 0;
	cursor: pointer;
}

@keyframes loadingPulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

.button.loading {
	pointer-events: none;
	animation: loadingPulse 1s ease-in-out infinite;
	opacity: 0.7;
}
