/* License evidence reader. One toolbar moves from the desktop header to the phone footer. */
dialog[data-fxm-license-viewer] {
	--reader-ink: #292833;
	--reader-muted: #646370;
	--reader-line: #e1dfe6;
	--reader-accent: #5b3aa6;
	--reader-selected: #f3effa;
	--reader-paper-surround: #eeeff2;
	--reader-page-gutter: clamp(16px, 2.6vw, 44px);
	position: fixed;
	inset: 0;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	overflow: hidden;
	overscroll-behavior: contain;
	border: 0;
	border-radius: 0;
	background: white;
	color: var(--reader-ink);
	color-scheme: light;
	font-family: inherit;
}
dialog[data-fxm-license-viewer][open] {
	display: grid;
	grid-template-columns: clamp(188px, 16vw, 238px) minmax(0, 1fr) auto auto;
	grid-template-rows: auto minmax(0, 1fr);
	grid-template-areas: "identity identity toolbar close" "attachments workspace workspace workspace";
}
[data-fxm-license-viewer]::backdrop { background: var(--reader-paper-surround, #eeeff2); }
.fxm-license-viewer *, .fxm-license-viewer *::before, .fxm-license-viewer *::after { box-sizing: border-box; }
.fxm-license-viewer [hidden] { display: none !important; }
.fxm-license-viewer :is(h2, h3, p) { margin: 0; }
.fxm-license-viewer button {
	appearance: none;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	touch-action: manipulation;
}
.fxm-license-viewer button:disabled { color: #a1a0a9; cursor: default; }
.fxm-license-viewer :focus-visible { outline: 2px solid var(--reader-accent); outline-offset: -2px; }

.fxm-license-viewer__identity {
	grid-area: identity;
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
	min-height: 66px;
	padding: max(8px, env(safe-area-inset-top)) 12px 8px max(24px, env(safe-area-inset-left));
}
.fxm-license-viewer__brand-logo {
	display: block;
	width: 68px;
	height: 40px;
	overflow: hidden;
	border-radius: 8px;
}
.fxm-license-viewer__identity > div { min-width: 0; }
.fxm-license-viewer [data-fxm-viewer-context] {
	overflow: hidden;
	font-size: 17px;
	font-weight: 650;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.fxm-license-viewer .fxm-license-viewer__reference {
	margin-top: 2px;
	overflow: hidden;
	color: var(--reader-muted);
	font-size: 12px;
	line-height: 1.4;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fxm-license-viewer__toolbar, .fxm-license-viewer__zoom-controls {
	display: flex;
	align-items: center;
}
.fxm-license-viewer__toolbar {
	grid-area: toolbar;
	align-self: center;
	gap: 10px;
	padding-top: env(safe-area-inset-top);
}
.fxm-license-viewer__zoom-controls,
.fxm-license-viewer button[data-fxm-viewer-action="reset"] {
	border: 1px solid var(--reader-line);
	border-radius: 9px;
	background: #fff;
}
.fxm-license-viewer [data-fxm-viewer-action] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 34px;
	height: 34px;
	border-radius: 8px;
}
.fxm-license-viewer [data-fxm-viewer-action] svg { width: 17px; height: 17px; flex: none; }
.fxm-license-viewer [data-fxm-viewer-zoom] {
	min-width: 4.6ch;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}
.fxm-license-viewer button[data-fxm-viewer-action="reset"] {
	gap: 7px;
	width: auto;
	min-height: 36px;
	padding-inline: 12px;
	font-size: 13px;
	font-weight: 550;
}
.fxm-license-viewer [data-mode="fit"] .fxm-license-viewer__width-icon,
.fxm-license-viewer [data-mode="width"] .fxm-license-viewer__fit-icon { display: none; }
.fxm-license-viewer button[data-fxm-viewer-action="close"] {
	grid-area: close;
	align-self: center;
	margin: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 16px;
	width: 38px;
	height: 38px;
	color: var(--reader-muted);
}

.fxm-license-viewer__attachments {
	grid-area: attachments;
	display: flex;
	flex-direction: column;
	min-height: 0;
	min-width: 0;
	padding: 20px 14px 14px max(14px, env(safe-area-inset-left));
	border-top: 1px solid var(--reader-line);
	border-right: 1px solid var(--reader-line);
	background: #fcfbfd;
}
.fxm-license-viewer__attachment-heading {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 0 4px 14px;
	font-size: 14px;
	font-weight: 650;
	line-height: 20px;
}
.fxm-license-viewer [data-fxm-viewer-count], .fxm-license-viewer [data-fxm-viewer-thumb-position] {
	color: var(--reader-muted);
	font-size: 11px;
	font-weight: 450;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.fxm-license-viewer__list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
}
.fxm-license-viewer .fxm-license-viewer__thumb {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 7px 6px;
	flex: none;
	width: 100%;
	padding: 7px 7px 8px;
	border: 1px solid transparent;
	border-radius: 10px;
	text-align: start;
}
.fxm-license-viewer__thumb[aria-current="true"] {
	border-color: #d5c8f0;
	background: var(--reader-selected);
}
.fxm-license-viewer__thumb-image {
	grid-column: 1 / -1;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	aspect-ratio: 1.95;
	min-width: 0;
	overflow: hidden;
	padding: 8px 10px 0;
	border-radius: 5px;
	background: #e9e9ed;
}
.fxm-license-viewer__thumb-image img {
	display: block;
	width: 78%;
	height: auto;
	max-width: none;
	box-shadow: 0 1px 5px #23213320;
}
.fxm-license-viewer [data-fxm-viewer-thumb-label] {
	min-width: 0;
	overflow-wrap: anywhere;
	color: var(--reader-ink);
	font-size: 13px;
	font-weight: 550;
	line-height: 1.4;
}
.fxm-license-viewer__thumb[aria-current="true"] [data-fxm-viewer-thumb-label] {
	color: var(--reader-accent);
	font-weight: 650;
}

.fxm-license-viewer__workspace {
	grid-area: workspace;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr);
	min-width: 0;
	min-height: 0;
	border-top: 1px solid var(--reader-line);
	background: var(--reader-paper-surround);
}
.fxm-license-viewer__attachments[hidden] ~ .fxm-license-viewer__workspace { grid-column: 1 / -1; }
.fxm-license-viewer__file {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	padding: 12px var(--reader-page-gutter);
	color: var(--reader-muted);
}
.fxm-license-viewer__file svg { flex: none; width: 16px; height: 16px; }
.fxm-license-viewer [data-fxm-viewer-caption] {
	min-width: 0;
	overflow: hidden;
	color: var(--reader-ink);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.45;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.fxm-license-viewer [data-fxm-viewer-dimensions] {
	margin-inline-start: auto;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.fxm-license-viewer__stage {
	position: relative;
	min-width: 0;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	scrollbar-color: #b9b7c2 var(--reader-paper-surround);
	touch-action: pan-x pan-y pinch-zoom;
}
.fxm-license-viewer__stage[data-pannable] { cursor: grab; }
.fxm-license-viewer__stage[data-dragging] { cursor: grabbing; }
.fxm-license-viewer__page {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	width: max-content;
	min-width: 100%;
	min-height: 100%;
	padding: 0 var(--reader-page-gutter) max(24px, env(safe-area-inset-bottom));
}
.fxm-license-viewer [data-fxm-viewer-image] {
	display: block;
	flex: none;
	max-width: none;
	max-height: none;
	background: white;
	box-shadow: 0 1px 2px #24243716, 0 3px 12px #24243710;
	pointer-events: none;
	user-select: none;
}
.fxm-license-viewer__status {
	position: absolute;
	top: 40%;
	inset-inline: 16px;
	color: var(--reader-muted);
	text-align: center;
	font-size: 14px;
	line-height: 1.6;
}
.fxm-license-viewer__status a {
	display: block;
	width: fit-content;
	margin: 6px auto;
	padding: 8px;
	color: var(--reader-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}
@media (hover: hover) {
	.fxm-license-viewer [data-fxm-viewer-action]:not(:disabled):hover,
	.fxm-license-viewer__thumb:not([aria-current="true"]):hover { background: #f2f1f5; }
}
.fxm-license-viewer [data-fxm-viewer-action]:not(:disabled):active { background: #eae6f2; }

@media (max-width: 720px) {
	dialog[data-fxm-license-viewer] { --reader-page-gutter: max(10px, env(safe-area-inset-left), env(safe-area-inset-right)); }
	dialog[data-fxm-license-viewer][open] {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-rows: auto auto minmax(0, 1fr) auto;
		grid-template-areas: "identity close" "attachments attachments" "workspace workspace" "toolbar toolbar";
	}
	.fxm-license-viewer__identity {
		gap: 8px;
		min-height: 57px;
		padding-inline-start: max(12px, env(safe-area-inset-left));
	}
	.fxm-license-viewer__brand-logo { width: 54px; height: 34px; border-radius: 6px; }
	.fxm-license-viewer [data-fxm-viewer-context] { font-size: 15px; }
	.fxm-license-viewer__reference { font-size: 11px; }
	.fxm-license-viewer button[data-fxm-viewer-action="close"] {
		margin-inline: 2px max(8px, env(safe-area-inset-right));
		width: 44px;
		height: 44px;
	}
	.fxm-license-viewer__attachments {
		flex-direction: row;
		align-items: center;
		gap: 8px;
		padding: 5px max(9px, env(safe-area-inset-right)) 5px max(12px, env(safe-area-inset-left));
		border-right: 0;
	}
	.fxm-license-viewer__attachment-heading { flex: none; gap: 4px; padding: 0; font-size: 12px; }
	.fxm-license-viewer__list {
		flex-direction: row;
		gap: 5px;
		min-width: 0;
		overflow-x: auto;
		scrollbar-width: thin;
	}
	.fxm-license-viewer .fxm-license-viewer__thumb {
		display: flex;
		gap: 6px;
		width: auto;
		max-width: 100%;
		min-height: 44px;
		padding: 4px 8px 4px 5px;
		border-color: var(--reader-line);
		border-radius: 7px;
		background: white;
	}
	.fxm-license-viewer .fxm-license-viewer__thumb[aria-current="true"] {
		border-color: #c5b4e4;
		background: var(--reader-selected);
	}
	.fxm-license-viewer__thumb-image { flex: none; width: 25px; height: 30px; padding: 0; border-radius: 3px; }
	.fxm-license-viewer__thumb-image img { width: 100%; }
	.fxm-license-viewer [data-fxm-viewer-thumb-label] { font-size: 12px; }
	.fxm-license-viewer [data-fxm-viewer-thumb-position] { display: none; }
	.fxm-license-viewer__file { gap: 6px; padding-block: 8px; }
	.fxm-license-viewer__file svg { width: 14px; height: 14px; }
	.fxm-license-viewer [data-fxm-viewer-caption], .fxm-license-viewer [data-fxm-viewer-dimensions] { font-size: 11.5px; }
	.fxm-license-viewer__page { padding-bottom: 12px; }
	.fxm-license-viewer__toolbar {
		justify-content: space-between;
		gap: 6px;
		padding: 4px max(10px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
		border-top: 1px solid var(--reader-line);
	}
	.fxm-license-viewer__toolbar [data-fxm-viewer-action] { width: 44px; height: 44px; }
	.fxm-license-viewer button[data-fxm-viewer-action="reset"] {
		flex: 0 1 auto;
		width: auto;
		height: auto;
		min-height: 44px;
		padding: 4px 9px;
		line-height: 1.35;
	}
}
