:root {
	--asecla-turbo-color: #0061B7;
}
html, body {
	background-color: #F5F5F5 !important;
}

/* Noto Sans LGC subset — same font embedded in Save-as-PDF; declared here so
   the browser can reference it inside @media print without compatibility issues.
   The file is only fetched when the print styles are actually applied. */
@font-face {
	font-family: 'Noto Sans LGC';
	src: url('/fonts/noto-sans-lgc-subset.ttf') format('truetype');
	font-weight: normal;
	font-style: normal;
	font-display: optional;
}

/* Paper letter card */
.section-outer {
	padding: 0.5em;
}
.section-inner {
	border-radius: 8px;
	padding: 2.5em 2em;
	border: 1px solid rgba(0, 0, 0, 0.07);
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 4px 12px rgba(0, 0, 0, 0.08),
		0 16px 32px rgba(0, 0, 0, 0.06);
}
.labelled-field {
	padding: 0;
}
.labelled-field label {
	padding-left: 0;
}
.envelope-info-box {
	background: var( --asecla-gray-50);
	border: 1px solid var(--asecla-gray-200);
	border-radius: 6px;
	padding: 1.1em 1.5em;
	margin-bottom: 1em;
}
.envelope-info-header {
	display: flex;
	align-items: center;
	gap: 0.55em;
	overflow: hidden;
}
.envelope-info-header strong {
	color: #004480;
	font-size: 1.15em;
}
.envelope-info-divider {
	border: none;
	border-top: 1px solid var(--asecla-gray-300);
	margin: 0.75em 0;
}
.envelope-info-row {
	display: flex;
	align-items: center;
	gap: 0.45em;
	margin: 0.45em 0;
	line-height: 1.5;
}
.envelope-info-label {
	color: #6b7280;
}
.envelope-time-badge {
	background: #d0e8fa;
	color: #0050a0;
	border-radius: 999px;
	padding: 0.1em 0.65em;
	margin-left: 0.5em;
	font-size: 0.88em;
	font-weight: 500;
	white-space: nowrap;
}
#readmsg-title {
	font-size: 150%;
}
button:disabled, button:hover:disabled {
	background-color: grey;
	cursor: default;
}

#openmsg-read-container {
	border: 1px solid #d9d9d9;
	padding: 0em 1.5em 0em 1.5em;
	border-radius: 6px;
}
#openmsg-read-content {
	margin: 1em 0;
	line-height: 1.5em;
	font-size: 125%;
	white-space: pre-wrap;
	word-break: break-word;
	overflow-wrap: break-word;
}
.unsafe-warning-icon {
	flex-shrink: 0;
	width: 1.25em;
	height: 1.25em;
	fill: #e0a800;
	margin-top: 0.1em;
}

/* Security Notice accordion */
.security-notice-accordion {
	border: 1px solid #d0d7de;
	border-radius: 6px;
	margin: 1em 0;
	overflow: hidden;
}
.security-notice-btn {
	display: flex;
	align-items: center;
	gap: 0.5em;
	width: 100%;
	padding: 0.75em 1em;
	background: #f6f8fa;
	border: none;
	cursor: pointer;
	font-size: 1em;
	font-weight: 600;
	color: #1f2328;
	text-align: left;
	text-shadow: none;
}
.security-notice-btn:hover {
	background: #eef1f4;
}
.security-notice-btn.unsafe {
	background: #fff3cd;
	color: #7d5a00;
}
.security-notice-btn.unsafe:hover {
	background: #ffe8a0;
}
.security-notice-shield {
	width: 1.2em;
	height: 1.2em;
	fill: none;
	stroke: #0061B7;
	stroke-width: 2;
	stroke-linejoin: round;
	flex-shrink: 0;
}
.security-notice-btn.unsafe .security-notice-shield {
	stroke: #b07800;
}
.security-notice-chevron {
	margin-left: auto;
	width: 1.1em;
	height: 1.1em;
	fill: #57606a;
	flex-shrink: 0;
	transition: transform 0.2s;
}
.security-notice-chevron.open {
	transform: rotate(180deg);
}
.security-notice-content {
	padding: 0.75em 1.25em 0.25em;
	border-top: 1px solid #d0d7de;
	color: #000;
}
.security-notice-content .hint {
	color: #000;
}

/* Shared layout for all status/error views */
.status-view {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0;
}
.status-icon-circle {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 1.25em;
}
.status-icon-circle svg {
	width: 40px;
	height: 40px;
}
.status-title {
	color: #0d2d5e;
	font-size: 1.6em;
	font-weight: 700;
	margin: 0 0 0.5em;
}
.status-subtitle {
	color: #6b7280;
	font-size: 1em;
	margin: 0;
}

/* Per-view icon colors */
.confirmed-icon-circle    { background-color: var(--asecla-success); }
.openings-limit-icon-circle  { background-color: #f59e0b; }
.access-denied-icon-circle { background-color: var(--asecla-error); }
.expired-icon-circle      { background-color: #9ca3af; }
.stopped-icon-circle      { background-color: #7c3aed; }
.invalid-link-icon-circle { background-color: #f97316; }
.server-error-icon-circle { background-color: #9ca3af; }
.open-error-icon-circle   { background-color: #f59e0b; }

/* Open error extras */
.open-error-message {
	color: #374151;
	font-size: 1em;
	margin: 0 0 0.5em;
}
.open-error-hint {
	color: #6b7280;
	font-size: 0.9em;
	max-width: 36em;
	margin: 0 0 0.5em;
}
.open-error-button {
	margin-top: 1em;
}
.server-error-button {
	margin-top: 1.5em;
}

#msg-id-container {
	text-align: center;
	margin: 2em;
	color: grey;
	font-size: 90%;
}
.msg-id-copy-row {
	display: inline-flex;
	align-items: center;
	gap: 0.25em;
}
.msgready-copy-id-btn {
	display: flex;
	align-items: center;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.2em;
	opacity: 0.5;
	flex-shrink: 0;
}
.msgready-copy-id-btn:hover {
	opacity: 1;
}
.msgready-copy-id-btn img {
	width: 1.1em;
	height: 1.1em;
}
.msgready-copy-id-tick {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.1em;
	height: 1.1em;
	color: #22c55e;
	font-weight: bold;
}

#openmsg-expiration-timeleft {
	float: right;
	background-color: var(--asecla-gray-200);
	color: black;
}

/* Reader primary action buttons: flex icon+text layout, matching box Copy Link button style */
.reader-primary-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
}

/* Video / Brochure / Website link row */
.info-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1.5em;
	margin: 0.5em 0 1em;
}

.info-link {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	color: var(--asecla-messages-link-color);
	text-decoration: none;
	font-size: 0.95em;
}

.info-link:hover {
	text-decoration: underline;
}

.info-link svg {
	width: 1.1em;
	height: 1.1em;
	flex-shrink: 0;
}

.confirm-receipt-btn {
	background-color: var(--asecla-success);
	border: 2px solid #16a34a;
}
.confirm-receipt-btn:hover {
	background-color: #16a34a;
	border-color: #16a34a;
	color: white;
}
.confirm-receipt-btn:hover .icon {
	filter: brightness(0) invert(1);
}

.reader-primary-btn .icon {
	width: 1.2em;
	height: 1.2em;
	flex-shrink: 0;
	margin-top: 0;
}

.reader-powered-by {
	text-align: center;
	margin: 1.5em 0 0.75em;
	color: #9ca3af;
	font-size: 0.82em;
	border-top: 1px solid #e5e7eb;
	padding-top: 1em;
}

.reader-powered-by a {
	color: #6b7280;
	text-decoration: none;
}

.reader-powered-by a:hover {
	text-decoration: underline;
}

.labelled-field label a {
	color: var(--asecla-messages-link-color);
	text-decoration: none;
}

.labelled-field label a:hover {
	text-decoration: underline;
}

/* Animated indicator for openings/checking states */
@keyframes reader-spin {
	to { transform: rotate(360deg); }
}

.reader-loading-view {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3em 1em;
	gap: 1em;
}

.reader-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #e5e7eb;
	border-top-color: var(--asecla-messages-brand-color);
	border-radius: 50%;
	animation: reader-spin 0.8s linear infinite;
	flex-shrink: 0;
}

.reader-loading-text {
	color: var(--asecla-color-text-hint);
	margin: 0;
}

/* ── Action bar: Copy Text / Print / Save as PDF ─────────────────────────── */
.msg-action-bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 2em;
	margin: 1em 0 0;
}
.msg-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.4em 0.85em;
	background: #f6f8fa;
	border: 1px solid #d0d7de;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.9em;
	color: #24292f;
	text-shadow: none;
}
.msg-action-btn:hover {
	background: #eef1f4;
	border-color: #9aa3ac;
}
.msg-action-btn:disabled,
.msg-action-btn:hover:disabled {
	opacity: 0.6;
	cursor: default;
	background: #f6f8fa;
	border-color: #d0d7de;
}
.msg-action-btn-success {
	color: #16a34a;
	border-color: #86efac;
	background: #f0fdf4;
}
.msg-action-btn-success:hover {
	background: #dcfce7;
	border-color: #4ade80;
}
.msg-action-icon {
	width: 1em;
	height: 1em;
	flex-shrink: 0;
}
.msg-action-spinner {
	display: inline-block;
	width: 0.9em;
	height: 0.9em;
	border: 2px solid #d0d7de;
	border-top-color: #57606a;
	border-radius: 50%;
	animation: reader-spin 0.7s linear infinite;
	flex-shrink: 0;
}

/* ── Print-only header (hidden on screen, shown when printing) ───────────── */
.print-only {
	display: none;
}

/* ── Print / Save as PDF media rules ─────────────────────────────────────── */
@media print {
	@page {
		margin: 1.5cm;
		size: A4 portrait;
	}

	/* Remove card chrome */
	.section-inner {
		border: none !important;
		box-shadow: none !important;
		padding: 0 !important;
	}

	/* Hide page chrome (header, footer, side-menu) and reset background to white */
	.asecla-commons-header-container,
	.asecla-commons-footer-container,
	.side-menu {
		display: none !important;
	}
	html, body {
		background: white !important;
	}

	/* Use the same Noto Sans LGC font as the PDF export for visual consistency,
	   except for the decrypted message body — we keep it monospaced so it stays
	   visually distinct from the metadata, matching the on-screen rendering. */
	body * {
		font-family: 'Noto Sans LGC', sans-serif !important;
	}
	#openmsg-read-content,
	#openmsg-read-content * {
		font-family: var(--asecla-messages-font-monospace) !important;
	}

	/* Hide interactive UI elements */
	.envelope-info-box,
	.security-notice-accordion,
	.msg-action-bar,
	#openmsg-confirm-button,
	#msg-id-container,
	.reader-powered-by,
	.attachment-btn,
	.attachment-bulk-actions,
	.attachment-unsafe-badge,
	.attachment-list-count {
		display: none !important;
	}

	/* Flatten the message container — PDF export has no card, so neither should print */
	#openmsg-read-container {
		border: none !important;
		border-radius: 0 !important;
		padding: 0 !important;
	}
	#openmsg-read-content {
		font-size: 100% !important;
		margin: 0 0 0.6em !important;
	}
	#openmsg-read-container > hr {
		border: none !important;
		border-top: 1px solid #c8c8c8 !important;
		margin: 0.8em 0 !important;
	}

	/* Match PDF "Attachments:" label — lowercase, normal weight, no count chip */
	.attachment-list-section {
		margin: 0 !important;
	}
	.attachment-list-header {
		font-weight: normal !important;
		text-transform: none !important;
		letter-spacing: 0 !important;
		color: #3c3c3c !important;
		font-size: 1em !important;
		margin-bottom: 0.45em !important;
	}
	.attachment-list-header::after {
		content: ':';
	}

	/* Don't highlight attachments as unsafe — irrelevant on a printed page */
	.attachment-item--unsafe {
		border-color: #e4e4e4 !important;
		background: #f8f8f8 !important;
	}
	.attachment-ext-badge--unsafe {
		background: #495057 !important;
	}

	/* Allow the hash line to be fully readable on paper (not faded as on screen) */
	.attachment-name {
		overflow: visible !important;
	}
	.attachment-hash {
		color: #888 !important;
		white-space: normal !important;
		word-break: break-all !important;
		overflow: visible !important;
		text-overflow: clip !important;
	}

	/* Show print-only header */
	.print-only {
		display: block !important;
	}

	/* Print header styles */
	.print-header {
		margin-bottom: 1em;
	}
	.print-header-title {
		font-size: 1.3em;
		font-weight: 700;
		color: #004080;
		margin-bottom: 0.4em;
	}
	.print-header-meta {
		font-size: 0.9em;
		color: #222;
		margin: 0.4em 0;
	}
	.print-header-row {
		display: flex;
		gap: 0.4em;
		margin: 0.12em 0;
		line-height: 1.35;
	}
	.print-header-label {
		color: #555;
		white-space: nowrap;
	}
	.print-header-divider {
		border: none;
		border-top: 1px solid #c8c8c8;
		margin: 0.55em 0 0.8em;
	}
	.print-header-divider--top {
		margin: 0.4em 0 0.45em;
	}
}

/* ── Terminate access block ──────────────────────────────────────────────── */
.terminate-block {
	margin-top: 1em;
	padding-top: 1em;
	border-top: 1px solid var(--asecla-gray-200, #f0f1f6);
	text-align: center;
}

.terminate-question {
	color: #5d6076;
	font-size: 0.875em;
	line-height: 1.5;
	margin: 0 0 0.625em;
}

.btn-terminate {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	min-width: 190px;
	padding: 0.6875em 1.125em;
	border: 1.5px solid #e4e6ef;
	border-radius: 8px;
	background: #fff;
	color: #5d6076;
	font: inherit;
	font-size: 0.875em;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
	text-shadow: none;
}

.btn-terminate:hover {
	border-color: #dc2626;
	background: #fef2f2;
	color: #dc2626;
}

.terminate-hint {
	max-width: 450px;
	margin: 0.5em auto 0;
	color: #8f91a6;
	font-size: 0.78125em;
	line-height: 1.5;
}

/* ── Terminate modal overlay + dialog ────────────────────────────────────── */
.terminate-modal-overlay {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 20px;
	background: rgba(10, 10, 25, 0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.terminate-modal {
	width: 100%;
	max-width: 430px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	animation: terminate-modal-slide-up 0.2s ease;
}

@keyframes terminate-modal-slide-up {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: translateY(0); }
}

.terminate-modal-body {
	padding: 28px 28px 20px;
}

.terminate-modal-icon {
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #fef2f2;
	color: #dc2626;
	font-size: 24px;
	margin-bottom: 16px;
}

.terminate-modal-title {
	color: #151529;
	font-size: 1.125em;
	font-weight: 700;
	letter-spacing: -0.01em;
	margin: 0 0 10px;
}

.terminate-modal-text {
	color: #5d6076;
	font-size: 0.875em;
	line-height: 1.6;
	margin: 0;
}

.terminate-modal-actions {
	display: flex;
	gap: 10px;
	padding: 16px 28px 24px;
}

.terminate-modal-btn {
	flex: 1;
	padding: 12px 16px;
	border-radius: 6px;
	font: inherit;
	font-size: 0.875em;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.18s ease, border-color 0.18s ease;
	text-shadow: none;
}

.terminate-modal-btn-cancel {
	border: 1.5px solid #e4e6ef;
	background: #f8f9fc;
	color: #5d6076;
}

.terminate-modal-btn-cancel:hover {
	background: #f0f1f6;
}

.terminate-modal-btn-confirm {
	border: 1.5px solid #dc2626;
	background: #dc2626;
	color: #fff;
}

.terminate-modal-btn-confirm:hover {
	border-color: #b91c1c;
	background: #b91c1c;
}


@media (max-width: 560px) {
	.terminate-modal-actions {
		flex-direction: column-reverse;
	}
	.terminate-modal {
		border-radius: 8px;
	}
}