/* AGT COC Forms – editor page */
:root {
	--agt-teal: #007c7d;
	--agt-teal-dk: #006364;
	--agt-ink: #192A26;
	--agt-mint: #76E28C;
	--agt-bg: #eef3f2;
	--agt-line: #d5e0de;
	--agt-font: Calibri, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body.agt-coc-editor {
	display: flex;
	flex-direction: column;
	font-family: var(--agt-font);
	color: var(--agt-ink);
	background: var(--agt-bg);
	-webkit-font-smoothing: antialiased;
}

/* Top bar */
.agt-coc-bar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 20px;
	background: #fff;
	border-bottom: 3px solid var(--agt-teal);
	flex: 0 0 auto;
	z-index: 5;
}
.agt-coc-brand { display: flex; align-items: center; text-decoration: none; color: var(--agt-ink); font-weight: 700; flex: 0 0 auto; }
.agt-coc-brand img { display: block; height: 40px; width: auto; max-width: 180px; object-fit: contain; }
.agt-coc-title {
	flex: 1 1 auto;
	margin: 0;
	padding-left: 16px;
	border-left: 1px solid var(--agt-line);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.agt-coc-actions { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.agt-coc-zoom { display: flex; border: 1px solid var(--agt-line); border-radius: 8px; overflow: hidden; }
.agt-coc-zoom button {
	appearance: none; border: 0; background: #fff; color: var(--agt-ink);
	font: 600 15px/1 var(--agt-font); height: 38px; min-width: 38px; padding: 0 10px; cursor: pointer;
}
.agt-coc-zoom button + button { border-left: 1px solid var(--agt-line); }
.agt-coc-zoom button:hover { background: var(--agt-bg); }
#agt-zoom-fit { min-width: 64px; font-variant-numeric: tabular-nums; }

.agt-coc-primary {
	appearance: none; display: inline-flex; align-items: center; gap: 8px;
	height: 42px; padding: 0 22px; border: 0; border-radius: 8px;
	background: var(--agt-teal); color: #fff;
	font: 700 16px/1 var(--agt-font); cursor: pointer;
	box-shadow: 0 2px 6px rgba(0,124,125,.25);
	transition: background .15s, transform .15s;
}
.agt-coc-primary:hover:not(:disabled) { background: var(--agt-teal-dk); }
.agt-coc-primary:active:not(:disabled) { transform: translateY(1px); }
.agt-coc-primary:disabled { opacity: .55; cursor: not-allowed; }
.agt-coc-primary.is-busy svg { animation: agt-bob .8s ease-in-out infinite; }
@keyframes agt-bob { 50% { transform: translateY(3px); } }
:is(button, a):focus-visible { outline: 3px solid var(--agt-mint); outline-offset: 2px; }

/* Help strip */
.agt-coc-help {
	display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: space-between;
	padding: 8px 20px; font-size: 14px; line-height: 1.4;
	background: #e3f1f0; border-bottom: 1px solid var(--agt-line); flex: 0 0 auto;
}
.agt-coc-notice { color: #43615b; }
.agt-coc-notice::before { content: "\2139\FE0E"; margin-right: 6px; color: var(--agt-teal); font-weight: 700; }

/* PDF area – PDF.js needs an absolutely positioned container */
.agt-coc-stage { position: relative; flex: 1 1 auto; min-height: 0; }
#viewerContainer { position: absolute; inset: 0; overflow: auto; outline: none; }
.pdfViewer { padding: 18px 0 40px; }
.pdfViewer .page {
	border: 0 !important;
	margin: 0 auto 18px !important;
	box-shadow: 0 1px 3px rgba(25,42,38,.12), 0 6px 24px rgba(25,42,38,.10);
}
/* Fillable fields in AGT teal instead of PDF.js blue */
.pdfViewer .annotationLayer {
	--annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0,124,125,0.10);'/></svg>");
	--input-focus-border-color: #007c7d;
	--input-focus-outline: 1px solid #76E28C;
}

/* Loading / errors / toast */
.agt-coc-loading {
	position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px;
	align-items: center; justify-content: center; font-size: 16px; color: #43615b; background: var(--agt-bg);
}
.agt-coc-loading[hidden] { display: none; }
.agt-coc-loading.is-error p { max-width: 460px; text-align: center; padding: 0 20px; }
.agt-coc-loading a { color: var(--agt-teal); font-weight: 700; }
.agt-coc-spinner {
	width: 38px; height: 38px; border-radius: 50%;
	border: 4px solid var(--agt-line); border-top-color: var(--agt-teal);
	animation: agt-spin .8s linear infinite;
}
@keyframes agt-spin { to { transform: rotate(360deg); } }

.agt-coc-toast {
	position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
	max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px;
	background: var(--agt-ink); color: #fff; font-size: 15px; line-height: 1.35;
	box-shadow: 0 8px 28px rgba(0,0,0,.25);
	opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.agt-coc-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.agt-coc-toast.is-ok::before { content: "\2713"; color: var(--agt-mint); font-weight: 700; margin-right: 8px; }
.agt-coc-toast.is-err { background: #8a1c1c; }
.agt-coc-noscript { padding: 20px; text-align: center; }

/* Phones */
@media (max-width: 720px) {
	.agt-coc-bar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
	.agt-coc-brand img { height: 32px; }
	.agt-coc-title { order: 3; flex-basis: 100%; padding-left: 0; border-left: 0; font-size: 16px; white-space: normal; }
	.agt-coc-actions { margin-left: auto; gap: 8px; }
	.agt-coc-zoom { display: none; }
	.agt-coc-primary { height: 40px; padding: 0 16px; }
	.agt-coc-help { padding: 8px 16px; font-size: 13px; }
	.agt-coc-help > span:first-child { display: none; }
	.pdfViewer { padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
	* { animation: none !important; transition: none !important; }
}

/* Small table cells: never show scrollbars/arrows – they hid the typed text */
.pdfViewer .annotationLayer .textWidgetAnnotation textarea {
	overflow: hidden !important;
	resize: none !important;
	scrollbar-width: none !important;
	line-height: 1.15 !important;
}
.pdfViewer .annotationLayer .textWidgetAnnotation textarea::-webkit-scrollbar { display: none !important; }
.pdfViewer .annotationLayer .textWidgetAnnotation :is(input, textarea) {
	color: #0b1f1a !important;
	padding-left: 2px !important;
	padding-right: 2px !important;
}
/* Checkboxes: clear dark tick, full box is clickable */
.pdfViewer .annotationLayer .buttonWidgetAnnotation.checkBox input { cursor: pointer; }
.pdfViewer .annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
.pdfViewer .annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after { background-color: #0b1f1a !important; }
