.xcms-fm {
	--fm-bg: #12161e;
	--fm-panel: #1a212c;
	--fm-border: #2c3645;
	--fm-text: #e8eef6;
	--fm-muted: #8b98a8;
	--fm-accent: #1fa28c;
	--fm-accent-2: #38bdf8;
	--fm-danger: #ef6b6b;
	--fm-folder: #f7b731;
	--fm-radius: 12px;
	--fm-shadow: 0 24px 60px rgba(0, 0, 0, .45);
	box-sizing: border-box;
	border: 1px solid var(--fm-border);
	border-radius: var(--fm-radius);
	background: var(--fm-panel);
	color: var(--fm-text);
	min-height: 360px;
	display: flex;
	flex-direction: column;
	font-family: inherit;
}

.xcms-fm *,
.xcms-fm *::before,
.xcms-fm *::after,
.xcms-fm-overlay *,
.xcms-fm-overlay *::before,
.xcms-fm-overlay *::after {
	box-sizing: border-box;
}

.xcms-fm.is-dragover {
	outline: 2px dashed var(--fm-accent);
	outline-offset: -4px;
}

.xcms-fm-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-bottom: 1px solid var(--fm-border);
}

.xcms-fm-crumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	flex: 1 1 180px;
	min-width: 0;
	font-size: 13px;
}

.xcms-fm-crumb {
	color: var(--fm-accent-2);
	text-decoration: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	cursor: pointer;
}

.xcms-fm-crumb.is-current {
	color: var(--fm-text);
	font-weight: 600;
	cursor: default;
}

.xcms-fm-sep {
	opacity: .45;
}

.xcms-fm-jump {
	width: auto;
	min-width: 140px;
	max-width: 220px;
	height: 32px;
	border-radius: 8px;
	border: 1px solid var(--fm-border);
	background: var(--fm-bg);
	color: var(--fm-text);
	padding: 0 8px;
	font: inherit;
	font-size: 13px;
}

.xcms-fm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 32px;
	padding: 0 10px;
	border-radius: 8px;
	border: 1px solid var(--fm-border);
	background: var(--fm-bg);
	color: var(--fm-text);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
}

.xcms-fm-btn:hover {
	border-color: var(--fm-accent);
}

.xcms-fm-btn svg {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.xcms-fm-btn-primary {
	background: var(--fm-accent);
	border-color: var(--fm-accent);
	color: #06241e;
	font-weight: 600;
}

.xcms-fm-btn-success {
	background: #15803d;
	border-color: #15803d;
	color: #fff;
	font-weight: 600;
}

.xcms-fm-btn-success input {
	display: none;
}

.xcms-fm-btn-danger {
	background: #b91c1c;
	border-color: #b91c1c;
	color: #fff;
	font-weight: 600;
}

.xcms-fm-mkdir,
.xcms-fm-confirm {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-bottom: 1px solid var(--fm-border);
	background: var(--fm-bg);
}

.xcms-fm-mkdir[hidden],
.xcms-fm-confirm[hidden] {
	display: none;
}

.xcms-fm-mkdir-input {
	flex: 1 1 180px;
	height: 32px;
	border-radius: 8px;
	border: 1px solid var(--fm-border);
	background: var(--fm-panel);
	color: var(--fm-text);
	padding: 0 10px;
	font: inherit;
	font-size: 13px;
}

.xcms-fm-mkdir-input:focus {
	outline: 2px solid var(--fm-accent);
	outline-offset: 1px;
}

.xcms-fm-confirm span {
	flex: 1 1 180px;
	font-size: 13px;
}

.xcms-fm-status {
	padding: 4px 12px;
	font-size: 12px;
	color: var(--fm-muted);
	min-height: 22px;
}

.xcms-fm-status.is-error {
	color: var(--fm-danger);
}

.xcms-fm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
	align-content: start;
	align-items: start;
	gap: 10px;
	padding: 12px;
	overflow: auto;
	flex: 1;
}

.xcms-fm-item {
	position: relative;
	display: flex;
	flex-direction: column;
	height: auto;
	border: 1px solid var(--fm-border);
	border-radius: 10px;
	padding: 8px;
	text-align: center;
	cursor: pointer;
	background: var(--fm-bg);
}

.xcms-fm-item:hover {
	border-color: var(--fm-accent);
}

.xcms-fm-preview {
	aspect-ratio: 1;
	width: 100%;
	height: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 6px;
	overflow: hidden;
	border-radius: 6px;
}

.xcms-fm-preview svg {
	width: 36px;
	height: 36px;
	stroke: var(--fm-folder);
	fill: none;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.xcms-fm-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.xcms-fm-name {
	font-size: 12px;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.xcms-fm-del {
	position: absolute;
	top: 4px;
	right: 4px;
	border: 0;
	background: rgba(0, 0, 0, .5);
	color: #fff;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0;
	cursor: pointer;
}

.xcms-fm-item:hover .xcms-fm-del {
	display: inline-flex;
}

.xcms-fm-del svg {
	width: 12px;
	height: 12px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
}

.xcms-fm-empty {
	grid-column: 1 / -1;
	padding: 40px 16px;
	text-align: center;
	color: var(--fm-muted);
}

.xcms-fm-overlay {
	position: fixed;
	inset: 0;
	z-index: 200000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(6, 10, 16, .72);
}

.xcms-fm-overlay.is-open {
	display: flex;
}

.xcms-fm-dialog {
	width: min(1100px, 100%);
	max-height: min(86vh, 820px);
	display: flex;
	flex-direction: column;
	background: var(--fm-panel, #1a212c);
	color: var(--fm-text, #e8eef6);
	border: 1px solid var(--fm-border, #2c3645);
	border-radius: 16px;
	box-shadow: var(--fm-shadow, 0 24px 60px rgba(0, 0, 0, .45));
	overflow: hidden;
}

.xcms-fm-dialog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--fm-border, #2c3645);
}

.xcms-fm-dialog-head h2 {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
}

.xcms-fm-close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.xcms-fm-close:hover {
	background: rgba(255, 255, 255, .06);
}

.xcms-fm-close svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
}

.xcms-fm-dialog-body {
	flex: 1;
	min-height: 0;
	padding: 12px;
	overflow: hidden;
	display: flex;
}

.xcms-fm-dialog-body .xcms-fm {
	flex: 1;
	min-height: 420px;
	border: 0;
}

body.xcms-fm-lock {
	overflow: hidden;
}
