.hpdf-editor[hidden] { display: none !important; }

.hpdf-editor {
	position: relative;
	width: min(1500px, calc(100vw - 32px));
	height: min(820px, calc(100vh - 90px));
	margin: 20px 50% 80px;
	transform: translateX(-50%);
	overflow: hidden;
	border: 1px solid #273241;
	border-radius: 18px;
	background: #0b1017;
	box-shadow: 0 28px 80px rgba(0,0,0,.45);
	color: #f6f7f9;
}

.hpdf-editor:fullscreen,
.hpdf-editor.is-fullscreen {
	width: 100vw;
	height: 100vh;
	margin: 0;
	transform: none;
	border: 0;
	border-radius: 0;
}

.hpdf-editor.is-fallback-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 999999;
	width: 100vw;
	height: 100dvh;
	margin: 0;
	transform: none;
	border: 0;
	border-radius: 0;
}

body.hpdf-no-scroll { overflow: hidden; }

.back-link.hpdf-back-button {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	min-height: 42px;
	padding: 0 15px;
	border: 1px solid #303b49;
	border-radius: 11px;
	background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.015)), #111822;
	box-shadow: 0 10px 28px rgba(0,0,0,.22);
	color: #dfe4ea;
	font-size: .82rem;
	font-weight: 800;
	text-decoration: none;
	transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.back-link.hpdf-back-button:hover,
.back-link.hpdf-back-button:focus-visible {
	transform: translateX(-3px);
	border-color: #ff1f2d;
	background-color: #18212d;
	color: white;
	outline: none;
}

.tool-steps li.is-complete { color: #aeb8c4; }
.tool-steps li.is-complete span {
	border-color: #24c875;
	background: rgba(36,200,117,.14);
	color: #50df96;
}
.tool-steps li.is-complete:not(:last-child)::after { background: #24c875; }
.tool-steps li.is-active:not(:last-child)::after { background: linear-gradient(90deg, #ff1f2d 0 18%, var(--line) 18%); }

.hpdf-editor__topbar,
.hpdf-editor__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 14px;
	border-bottom: 1px solid #273241;
	background: #111822;
}

.hpdf-editor__topbar { min-height: 68px; }
.hpdf-editor__document { display: grid; min-width: 180px; max-width: 250px; margin-right: auto; gap: 4px; }
.hpdf-editor__document strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.hpdf-editor__document small { color: #8d98a6; font-size: .72rem; }

.hpdf-toolbar-group { display: flex; align-items: center; gap: 5px; }
.hpdf-toolbar-group--history { margin-left: auto; padding-left: 14px; border-left: 1px solid #303b49; }

.hpdf-icon-button,
.hpdf-tool-button,
.hpdf-action-button,
.hpdf-zoom-value {
	min-height: 38px;
	border: 1px solid #303b49;
	border-radius: 9px;
	background: #18212d;
	color: #dce1e7;
	cursor: pointer;
	font: inherit;
}

.hpdf-icon-button { min-width: 38px; padding: 0 10px; font-size: 1.25rem; }
.hpdf-tool-button, .hpdf-action-button { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; font-size: .78rem; font-weight: 750; }
.hpdf-zoom-value { min-width: 67px; padding-inline: 10px; font-size: .77rem; }
.hpdf-icon-button:hover:not(:disabled), .hpdf-tool-button:hover:not(:disabled), .hpdf-action-button:hover:not(:disabled), .hpdf-zoom-value:hover { border-color: #ff1f2d; background: #202b39; }
.hpdf-tool-button.is-active { border-color: #ff1f2d; background: rgba(255,31,45,.13); color: #fff; }
button:disabled { opacity: .38; cursor: not-allowed; }

.hpdf-signature-button {
	position: relative;
	min-height: 44px;
	padding: 0 12px 0 8px;
	border-color: #ff4250;
	background: linear-gradient(135deg, #ff2535, #d50b1b);
	color: #fff;
	box-shadow: 0 8px 24px rgba(255,31,45,.27);
	overflow: hidden;
	animation: hpdf-signature-attention 1.05s ease-in-out .35s 2;
}

.hpdf-signature-button__icon {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	background: rgba(255,255,255,.16);
}

.hpdf-signature-button__icon svg {
	width: 19px;
	height: 19px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.hpdf-signature-button small {
	margin-left: 3px;
	padding: 4px 7px;
	border-radius: 999px;
	background: #fff;
	color: #c90a19;
	font-size: .6rem;
	font-weight: 900;
	letter-spacing: .02em;
	line-height: 1;
	text-transform: uppercase;
}

.hpdf-editor .hpdf-signature-button:hover:not(:disabled) {
	border-color: #ff6b76;
	background: linear-gradient(135deg, #ff3c4a, #e20d1e);
	box-shadow: 0 11px 30px rgba(255,31,45,.38);
	transform: translateY(-1px);
}

.hpdf-signature-button:focus-visible {
	outline: 3px solid rgba(255,90,101,.42);
	outline-offset: 3px;
}

@keyframes hpdf-signature-attention {
	0%, 100% { transform: scale(1); box-shadow: 0 8px 24px rgba(255,31,45,.27); }
	50% { transform: scale(1.035); box-shadow: 0 10px 34px rgba(255,31,45,.55); }
}

.hpdf-page-field { display: flex; align-items: center; gap: 7px; color: #97a1ae; font-size: .78rem; }
.hpdf-page-field input { width: 46px; height: 38px; border: 1px solid #303b49; border-radius: 8px; background: #0d141d; color: #fff; text-align: center; }

.hpdf-save-button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 16px;
	border: 0;
	border-radius: 10px;
	background: linear-gradient(135deg, #ff1f2d, #cb0c1a);
	color: white;
	cursor: pointer;
	font: inherit;
	font-size: .8rem;
	font-weight: 850;
}

.hpdf-save-button__hint {
	display: none;
	margin-left: 3px;
	padding: 4px 7px;
	border-radius: 999px;
	background: #fff;
	color: #c90a19;
	font-size: .6rem;
	font-weight: 900;
	letter-spacing: .02em;
	line-height: 1;
	text-transform: uppercase;
}

.hpdf-editor.has-signature .hpdf-signature-button small { display: none; }
.hpdf-editor.has-signature:not(.has-downloaded) .hpdf-save-button__hint { display: inline-flex; }
.hpdf-editor.has-signature:not(.has-downloaded) .hpdf-save-button {
	animation: hpdf-signature-attention 1.05s ease-in-out .18s 2;
}

.hpdf-editor__actions { min-height: 57px; padding-block: 8px; background: #0e151e; }
.hpdf-editor__status { min-height: 28px; padding: 7px 18px; border-bottom: 1px solid #222c39; background: #0b1119; color: #8f9baa; font-size: .74rem; }
.hpdf-editor__status.is-error { color: #ff8992; }

.hpdf-editor__workspace {
	position: absolute;
	inset: 154px 0 0;
	overflow: auto;
	padding: 38px;
	background: #202832;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.hpdf-editor__workspace.has-hand-tool { cursor: grab; touch-action: none; }
.hpdf-editor__workspace.is-grabbing { cursor: grabbing; user-select: none; }

.hpdf-editor__page {
	position: relative;
	margin: 0 auto;
	background: white;
	box-shadow: 0 12px 45px rgba(0,0,0,.38);
}

.hpdf-editor__page canvas { display: block; }
.hpdf-editor__overlay { position: absolute; inset: 0; pointer-events: none; }

.hpdf-completion[hidden] { display: none !important; }
.hpdf-completion {
	position: absolute;
	left: 50%;
	bottom: 18px;
	z-index: 20;
	display: grid;
	grid-template-columns: auto minmax(180px,1fr) auto;
	align-items: center;
	gap: 16px;
	width: min(920px, calc(100% - 32px));
	padding: 16px 18px;
	transform: translate(-50%, 24px);
	border: 1px solid rgba(36,200,117,.45);
	border-radius: 16px;
	background: rgba(13,26,23,.97);
	box-shadow: 0 25px 75px rgba(0,0,0,.5);
	opacity: 0;
	transition: opacity 180ms ease, transform 180ms ease;
}
.hpdf-completion.is-visible { transform: translate(-50%,0); opacity: 1; }
.hpdf-completion:focus { outline: 2px solid rgba(36,200,117,.55); outline-offset: 3px; }
.hpdf-completion__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #24c875; color: #06120c; font-size: 1.35rem; font-weight: 950; }
.hpdf-completion__copy { display: grid; gap: 4px; }
.hpdf-completion__copy strong { color: white; font-size: .96rem; }
.hpdf-completion__copy span { color: #94aa9d; font-size: .76rem; }
.hpdf-completion__actions { display: flex; align-items: center; gap: 8px; }
.hpdf-completion__secondary,
.hpdf-completion__primary { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 0 12px; border-radius: 9px; cursor: pointer; font: inherit; font-size: .74rem; font-weight: 850; text-decoration: none; white-space: nowrap; }
.hpdf-completion__secondary { border: 1px solid #3b5047; background: #16241f; color: #dce5e0; }
.hpdf-completion__primary { border: 0; background: #24c875; color: #07140d; }
.hpdf-completion__secondary:hover, .hpdf-completion__primary:hover { filter: brightness(1.1); }
.hpdf-edit-element {
	position: absolute;
	z-index: 3;
	min-width: 34px;
	min-height: 20px;
	border: 1px solid transparent;
	cursor: move;
	pointer-events: auto;
	touch-action: none;
	user-select: none;
}
.hpdf-edit-element:hover,
.hpdf-edit-element.is-selected { border-color: #1689ff; outline: 2px solid rgba(22,137,255,.2); }
.hpdf-edit-element img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.hpdf-element-remove {
	position: absolute;
	top: -13px;
	right: -13px;
	display: none;
	place-items: center;
	width: 25px;
	height: 25px;
	padding: 0;
	border: 2px solid white;
	border-radius: 50%;
	background: #e10e20;
	color: white;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
}
.hpdf-element-resize {
	position: absolute;
	right: -8px;
	bottom: -8px;
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid white;
	border-radius: 3px;
	background: #1689ff;
	cursor: nwse-resize;
}
.hpdf-edit-element.is-selected .hpdf-element-remove,
.hpdf-edit-element.is-selected .hpdf-element-resize { display: grid; }

.hpdf-signature-modal[hidden],
.hpdf-signature-panel[hidden] { display: none !important; }
.hpdf-signature-modal {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: grid;
	place-items: center;
	padding: 20px;
	background: rgba(3,6,10,.78);
	backdrop-filter: blur(9px);
}
.hpdf-signature-dialog {
	width: min(720px, 100%);
	max-height: min(780px, calc(100dvh - 30px));
	overflow: auto;
	border: 1px solid #303b49;
	border-radius: 20px;
	background: #111822;
	box-shadow: 0 35px 100px rgba(0,0,0,.62);
	color: #f6f7f9;
}
.hpdf-signature-dialog__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	padding: 24px 26px 18px;
}
.hpdf-signature-dialog__header small { color: #ff5360; font-size: .7rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.hpdf-signature-dialog__header h2 { margin: 5px 0 0; color: #f6f7f9; font-size: 1.65rem; letter-spacing: -.03em; }
.hpdf-dialog-close { border: 0; background: transparent; color: #9aa5b2; cursor: pointer; font-size: 2rem; line-height: 1; }

.hpdf-signature-tabs {
	display: grid;
	grid-template-columns: minmax(0,1fr) 30px minmax(0,1fr) 30px minmax(0,1fr);
	align-items: center;
	gap: 7px;
	margin: 0 26px;
	padding: 0;
}
.hpdf-signature-tabs button {
	display: grid;
	place-content: center;
	gap: 3px;
	min-height: 58px;
	padding: 7px 9px;
	border: 1px solid #303b49;
	border-radius: 11px;
	background: #0a1017;
	color: #8f9aa8;
	cursor: pointer;
	font: inherit;
	transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}
.hpdf-signature-tabs button strong { font-size: .84rem; font-weight: 850; }
.hpdf-signature-tabs button small { color: #6f7c8c; font-size: .64rem; font-weight: 700; }
.hpdf-signature-tabs button:hover { transform: translateY(-1px); border-color: #536176; color: #fff; }
.hpdf-signature-tabs button[aria-selected="true"] {
	border-color: #ff3b49;
	background: linear-gradient(145deg, rgba(255,31,45,.16), rgba(255,31,45,.055)), #151d28;
	color: white;
	box-shadow: 0 8px 22px rgba(255,31,45,.16), inset 0 0 0 1px rgba(255,70,82,.12);
}
.hpdf-signature-tabs button[aria-selected="true"] small { color: #ff9aa2; }
.hpdf-choice-separator {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border: 1px solid #344153;
	border-radius: 50%;
	background: #111822;
	color: #a8b2bf;
	font-size: .62rem;
	font-weight: 950;
	letter-spacing: .04em;
}
.hpdf-signature-panel { padding: 22px 26px 0; }

.hpdf-signature-upload {
	display: grid;
	place-items: center;
	min-height: 120px;
	padding: 20px;
	border: 1px dashed #435165;
	border-radius: 14px;
	background: #0d141d;
	cursor: pointer;
	text-align: center;
}
.hpdf-signature-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.hpdf-signature-upload__title { color: #50df96; font-size: 1rem; font-weight: 850; }
.hpdf-signature-upload__source { margin-top: 4px; color: #d0d7df; font-size: .82rem; font-weight: 700; }
.hpdf-signature-upload small { margin-top: 7px; color: #7f8a98; }

.hpdf-signature-preview {
	display: grid;
	place-items: center;
	min-height: 155px;
	margin-top: 14px;
	overflow: hidden;
	border-radius: 12px;
	background-color: #fff;
	background-image: linear-gradient(45deg,#eee 25%,transparent 25%),linear-gradient(-45deg,#eee 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#eee 75%),linear-gradient(-45deg,transparent 75%,#eee 75%);
	background-position: 0 0,0 8px,8px -8px,-8px 0;
	background-size: 16px 16px;
}
.hpdf-signature-preview img { display: block; max-width: 90%; max-height: 140px; object-fit: contain; }
.hpdf-signature-preview img[hidden] { display: none !important; }
.hpdf-signature-preview canvas { display: block; width: 100%; height: auto; max-height: 180px; }

.hpdf-draw-toolbar { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 10px; color: #8995a3; font-size: .8rem; }
.hpdf-draw-toolbar button { border: 0; background: transparent; color: #ff6b76; cursor: pointer; font-weight: 800; }
.hpdf-signature-canvas { display: block; width: 100%; height: min(240px, 35vh); border: 1px solid #d7dce2; border-radius: 12px; background: white; cursor: crosshair; touch-action: none; }

.hpdf-signature-type-label { display: grid; gap: 8px; color: #a8b1bc; font-size: .8rem; }
.hpdf-signature-type-label input { height: 48px; padding: 0 14px; border: 1px solid #354253; border-radius: 10px; background: #0b1119; color: white; font: inherit; font-size: 1rem; }
.hpdf-font-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.hpdf-font-options button { min-height: 52px; border: 1px solid #354253; border-radius: 10px; background: #151e29; color: white; cursor: pointer; font-size: 1.05rem; }
.hpdf-font-options button.is-selected { border-color: #ff1f2d; background: rgba(255,31,45,.08); }
.hpdf-font-elegant { font-family: "Brush Script MT","Segoe Script",cursive; }
.hpdf-font-classic { font-family: Georgia,serif; font-style: italic; }
.hpdf-font-modern { font-family: "Segoe Print","Comic Sans MS",cursive; }

.hpdf-signature-message { min-height: 20px; margin: 13px 26px 0; color: #99b7a4; font-size: .77rem; }
.hpdf-signature-message.is-error { color: #ff8992; }
.hpdf-signature-dialog__footer {
	position: sticky;
	bottom: 0;
	z-index: 3;
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 16px 26px 20px;
	border-top: 1px solid rgba(48,59,73,.72);
	background: rgba(17,24,34,.97);
	box-shadow: 0 -14px 28px rgba(7,11,16,.28);
	backdrop-filter: blur(10px);
}
.hpdf-secondary-button, .hpdf-primary-button { min-width: 110px; min-height: 44px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 850; }
.hpdf-secondary-button { border: 1px solid #354253; background: #17212c; color: #dce1e7; }
.hpdf-primary-button { border: 0; background: linear-gradient(135deg,#ff1f2d,#cb0c1a); color: white; }
.hpdf-primary-button:disabled { background: #2a3440; color: #66717f; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 1050px) {
	.hpdf-editor { height: calc(100vh - 40px); }
	.hpdf-editor__topbar { flex-wrap: wrap; }
	.hpdf-editor__document { min-width: 140px; }
	.hpdf-editor__workspace { inset-block-start: 207px; }
}

@media (max-width: 720px) {
	.hpdf-editor { width: 100vw; height: 100dvh; margin: 0 50%; border-inline: 0; border-radius: 0; }
	.hpdf-editor__topbar { gap: 8px; padding: 9px; }
	.hpdf-editor__document { width: calc(100% - 135px); max-width: none; }
	.hpdf-toolbar-group--pages { order: 3; }
	.hpdf-toolbar-group--pages + .hpdf-toolbar-group { order: 4; margin-left: auto; }
	.hpdf-tool-button span:last-child { font-size: 0; }
	.hpdf-save-button {
		min-width: 122px;
		margin-left: auto;
		padding-inline: 11px;
		font-size: .72rem;
		white-space: nowrap;
	}
	.hpdf-save-button span { font-size: .95rem; }
	.hpdf-editor__actions { overflow-x: auto; padding: 9px; }
	.hpdf-action-button { white-space: nowrap; }
	.hpdf-signature-button small { display: none; }
	.hpdf-save-button__hint { display: none !important; }
	.hpdf-toolbar-group--history { margin-left: 0; }
	.hpdf-editor__workspace { inset-block-start: 214px; padding: 24px 14px; }
	.hpdf-signature-modal { padding: 8px; }
	.hpdf-signature-dialog { max-height: calc(100dvh - 16px); border-radius: 15px; }
	.hpdf-signature-dialog__header, .hpdf-signature-panel { padding-inline: 16px; }
	.hpdf-signature-tabs { margin-inline: 16px; }
	.hpdf-signature-tabs {
		grid-template-columns: minmax(0,1fr) 22px minmax(0,1fr) 22px minmax(0,1fr);
		gap: 4px;
	}
	.hpdf-signature-tabs button { min-height: 55px; padding-inline: 4px; }
	.hpdf-signature-tabs button strong { font-size: .75rem; }
	.hpdf-signature-tabs button small { font-size: .54rem; }
	.hpdf-choice-separator { width: 22px; height: 22px; font-size: .52rem; }
	.hpdf-signature-message { margin-inline: 16px; }
	.hpdf-signature-dialog__footer { padding: 14px 16px; }
	.hpdf-font-options button { font-size: .85rem; }
	.hpdf-completion { grid-template-columns: auto 1fr; bottom: 10px; gap: 11px; padding: 13px; }
	.hpdf-completion__actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
	.hpdf-completion__primary { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
	.hpdf-signature-button, .hpdf-save-button { animation: none !important; }
}
