/* AM – Asset Library picker. All selectors are prefixed .amal- (no theme bleed). */
html.amal-open { overflow: hidden; }
.amal-overlay {
	position: fixed; inset: 0; z-index: 100000;
	background: rgba(0, 0, 0, .45);
	display: flex; align-items: flex-end; justify-content: center;
}
.amal-dialog {
	box-sizing: border-box;
	width: 100%; max-height: 92vh; height: 92vh;
	background: #fff; color: #1d2327;
	border-radius: 14px 14px 0 0;
	display: flex; flex-direction: column;
	font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	padding-bottom: env(safe-area-inset-bottom);
}
.amal-dialog *, .amal-dialog *::before, .amal-dialog *::after { box-sizing: border-box; }
.amal-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #e5e5e5; }
.amal-title { margin: 0; font-size: 17px; font-weight: 700; }
.amal-close { width: 44px; height: 44px; border: 0; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; color: inherit; }
.amal-tabs { display: flex; gap: 6px; padding: 8px 14px 0; }
.amal-tab { min-height: 40px; padding: 0 14px; border: 1px solid #d0d0d0; border-radius: 20px; background: #fff; cursor: pointer; font: inherit; color: inherit; }
.amal-tab.is-active { background: #1d2327; color: #fff; border-color: #1d2327; }
.amal-tools { display: flex; gap: 8px; padding: 10px 14px; }
.amal-tools[hidden] { display: none; }
.amal-search, .amal-category { min-height: 44px; font-size: 16px; border: 1px solid #c3c4c7; border-radius: 8px; padding: 0 10px; background: #fff; color: inherit; }
.amal-search { flex: 1 1 auto; min-width: 0; }
.amal-category { flex: 0 1 40%; min-width: 0; }
.amal-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 14px 14px; overscroll-behavior: contain; }
.amal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.amal-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 1px solid #e2e2e2; border-radius: 10px; background: #fafafa; cursor: pointer; min-height: 44px; font: inherit; color: inherit; }
.amal-tile img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: repeating-conic-gradient(#f1f1f1 0 25%, #fff 0 50%) 50% / 16px 16px; border-radius: 6px; }
.amal-tile-title { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amal-tile.is-loading { opacity: .5; pointer-events: none; }
.amal-grid .amal-status, .amal-grid .amal-sentinel { grid-column: 1 / -1; }
.amal-section { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #646970; margin: 12px 0 6px; }
.amal-fontlist { display: flex; flex-direction: column; }
.amal-font { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 56px; padding: 8px 10px; border: 0; border-bottom: 1px solid #eee; background: #fff; text-align: left; cursor: pointer; color: inherit; }
.amal-font:hover, .amal-font:focus-visible { background: #f3f6fb; }
.amal-font-name { font-size: 20px; line-height: 1.25; }
.amal-font-sample { font-size: 14px; color: #50575e; }
.amal-font[data-state="pending"] .amal-font-sample { opacity: .5; }
.amal-status { text-align: center; color: #646970; margin: 10px 0; }
.amal-sentinel { height: 1px; }
.amal-upload { padding: 12px 0; display: grid; gap: 8px; }
.amal-upload-btn { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 2px dashed #8c8f94; border-radius: 10px; cursor: pointer; text-align: center; padding: 8px; }
.amal-upload-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.amal-upload-btn:focus-within { outline: 2px solid #2271b1; }
.amal-save { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.amal-note { margin: 0; color: #646970; font-size: 13px; }
@media (min-width: 700px) {
	.amal-overlay { align-items: center; }
	.amal-dialog { width: 760px; height: 80vh; border-radius: 12px; }
	.amal-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
