/* WP Unionbreaks — beheer. Bouwt voort op de WordPress-adminstijl. */

.ub-wrap {
	--ub-border: #dcdcde;
	--ub-muted: #646970;
	--ub-bg: #fff;
	--ub-accent: #2271b1;
	--ub-danger: #b32d2e;
	--ub-warn-bg: #fcf9e8;
	--ub-ok: #00a32a;
	max-width: 1280px;
}

.ub-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
}

.ub-header .wp-heading-inline {
	margin-right: 4px;
}

.ub-muted {
	color: var(--ub-muted);
}

.ub-help {
	color: var(--ub-muted);
	font-size: 13px;
	margin: 6px 0 0;
}

.ub-card {
	background: var(--ub-bg);
	border: 1px solid var(--ub-border);
	border-radius: 4px;
	padding: 16px 20px;
	margin: 16px 0;
}

.ub-card > h2,
.ub-card-head h2 {
	font-size: 15px;
	margin: 0 0 12px;
}

.ub-card-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
}

.ub-notice .ub-list {
	margin: 0 0 8px 18px;
	list-style: disc;
}

.ub-list {
	list-style: disc;
	margin: 6px 0 6px 20px;
}

/* Formuliergrid */

.ub-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 12px 16px;
}

.ub-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.ub-field[hidden] {
	display: none;
}

.ub-field label,
.ub-label {
	font-weight: 600;
	font-size: 12px;
}

.ub-field input[type="text"],
.ub-field input[type="email"],
.ub-field input[type="date"],
.ub-field select,
.ub-field textarea {
	width: 100%;
	max-width: none;
}

.ub-field--wide,
.ub-field--card_name,
.ub-field--notes,
.ub-field--iban {
	grid-column: span 2;
}

.ub-field--full {
	grid-column: 1 / -1;
}

.ub-field.is-disabled {
	opacity: 0.5;
}

.ub-has-error input,
.ub-has-error select,
.ub-has-error textarea {
	border-color: var(--ub-danger);
	box-shadow: 0 0 0 1px var(--ub-danger);
}

.ub-field-error {
	color: var(--ub-danger);
	font-size: 12px;
}

.ub-segmented {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	padding-top: 4px;
}

.ub-inline {
	font-weight: 400 !important;
}

/* Kaartregels */

.ub-line {
	border: 1px solid var(--ub-border);
	border-radius: 4px;
	padding: 10px 14px 12px;
	margin: 0 0 12px;
	position: relative;
	background: #fbfbfc;
}

.ub-line legend {
	font-weight: 600;
	padding: 0 6px;
}

.ub-line-title {
	font-weight: 400;
	color: var(--ub-muted);
}

.ub-line-actions {
	display: flex;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin: -4px 0 6px;
}

.ub-line-actions .button-link {
	font-size: 12px;
	text-decoration: none;
}

.ub-danger,
.ub-line-actions .ub-danger {
	color: var(--ub-danger);
}

.ub-grid--line {
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 8px 12px;
}

.ub-line-total {
	font-variant-numeric: tabular-nums;
	padding-top: 6px;
	font-weight: 600;
}

.ub-photos {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 10px;
	margin-top: 10px;
}

.ub-photo {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 12px;
}

.ub-photo img,
.ub-photos--small img {
	object-fit: cover;
	border-radius: 3px;
	border: 1px solid var(--ub-border);
	background: #f0f0f1;
}

.ub-photos--small {
	margin-top: 4px;
	gap: 4px;
}

.ub-import {
	border-top: 1px dashed var(--ub-border);
	margin-top: 12px;
	padding-top: 12px;
}

/* Totalen */

.ub-totals {
	display: grid;
	grid-template-columns: max-content max-content;
	gap: 4px 24px;
	justify-content: end;
	margin: 16px 0 0;
	font-variant-numeric: tabular-nums;
}

.ub-totals dt {
	color: var(--ub-muted);
}

.ub-totals dd {
	margin: 0;
	text-align: right;
}

.ub-totals .ub-grand {
	font-weight: 700;
	font-size: 15px;
	color: #1d2327;
	border-top: 1px solid var(--ub-border);
	padding-top: 6px;
}

/* Opslaan */

.ub-savebar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 20px;
	align-items: flex-end;
	position: sticky;
	bottom: 0;
	z-index: 10;
	box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.ub-savebar .ub-field {
	flex: 1 1 320px;
}

.ub-readiness {
	background: var(--ub-warn-bg);
}

.ub-readiness summary,
.ub-cancel summary {
	cursor: pointer;
	font-weight: 600;
}

.ub-cancel form {
	margin-top: 10px;
}

.ub-button-danger.button {
	color: var(--ub-danger);
	border-color: var(--ub-danger);
}

/* Overzicht */

.ub-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 16px 0 8px;
}

.ub-tab {
	border: 1px solid var(--ub-border);
	border-radius: 999px;
	padding: 4px 12px;
	text-decoration: none;
	background: #fff;
	color: #1d2327;
}

.ub-tab.is-active {
	background: var(--ub-accent);
	border-color: var(--ub-accent);
	color: #fff;
}

.ub-tab.is-empty:not(.is-active) {
	color: var(--ub-muted);
}

.ub-count {
	font-variant-numeric: tabular-nums;
	opacity: 0.8;
	margin-left: 2px;
}

.ub-search {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin: 8px 0 12px;
}

.ub-toolbar {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.ub-empty {
	background: #fff;
	border: 1px dashed var(--ub-border);
	padding: 24px;
	text-align: center;
	color: var(--ub-muted);
}

.ub-table-wrap {
	overflow-x: auto;
}

.ub-table td,
.ub-table th {
	vertical-align: top;
}

.ub-table .num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ub-table tr.is-current td {
	background: #f0f6fc;
}

.ub-ref {
	font-weight: 600;
	font-family: Consolas, Monaco, monospace;
}

.ub-badge {
	display: inline-block;
	border-radius: 3px;
	padding: 1px 8px;
	font-size: 12px;
	font-weight: 600;
	background: #f0f0f1;
	color: #1d2327;
	white-space: nowrap;
}

.ub-badge--draft {
	background: #f0f6fc;
	color: #0a4b78;
}

.ub-badge--cancelled,
.ub-badge--rejected,
.ub-badge--expired,
.ub-badge--superseded {
	background: #f6f7f7;
	color: var(--ub-muted);
}

.ub-badge--exact_failed,
.ub-badge--disputed {
	background: #fcf0f1;
	color: var(--ub-danger);
}

.ub-badge--completed,
.ub-badge--exact_posted,
.ub-badge--fully_signed {
	background: #edfaef;
	color: #007017;
}

.ub-result--failure,
.ub-result--denied {
	color: var(--ub-danger);
	font-weight: 600;
}

.ub-result--warning {
	color: #996800;
	font-weight: 600;
}

.ub-details {
	white-space: pre-wrap;
	word-break: break-word;
	font-size: 11px;
	background: transparent;
}

.ub-check {
	font-weight: 600;
}

.ub-check--ok {
	color: var(--ub-ok);
}

.ub-check--warn {
	color: #996800;
}

.ub-pre {
	background: #f6f7f7;
	padding: 12px;
	overflow-x: auto;
}

/* Alleen-lezen overeenkomst */

.ub-doc h3 {
	font-size: 13px;
	margin: 18px 0 6px;
}

.ub-parties {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 16px;
	margin-bottom: 12px;
}

.ub-parties h3 {
	margin-top: 0;
}

.ub-terms {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 4px 16px;
}

.ub-terms dt {
	color: var(--ub-muted);
}

.ub-terms dd {
	margin: 0;
}

@media (max-width: 782px) {
	.ub-field--wide,
	.ub-field--card_name,
	.ub-field--notes,
	.ub-field--iban {
		grid-column: 1 / -1;
	}

	.ub-card {
		padding: 12px;
	}

	.ub-totals {
		justify-content: stretch;
	}

	.ub-savebar {
		position: static;
		box-shadow: none;
	}
}

/* ---------- Ondertekenen ---------- */
.ub-sigbox {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 16px;
	margin: 8px 0 4px;
}

.ub-sigbox-cell {
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	padding: 12px 14px;
	background: #fff;
}

.ub-sigbox-cell.is-signed {
	border-style: solid;
	border-color: #00a32a;
}

.ub-sigbox-role {
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: 11px;
	font-weight: 700;
	color: #646970;
}

.ub-sigbox-party {
	font-weight: 600;
	margin-bottom: 6px;
}

.ub-sigbox-line {
	height: 96px;
	border-bottom: 1px solid #1d2327;
	display: flex;
	align-items: flex-end;
	justify-content: flex-start;
	margin-bottom: 8px;
}

.ub-sigbox-line img {
	max-height: 92px;
	max-width: 100%;
	object-fit: contain;
	object-position: left bottom;
}

.ub-sigbox-empty {
	color: #8c8f94;
	font-style: italic;
	padding-bottom: 6px;
}

.ub-sigbox-meta {
	font-size: 12px;
	line-height: 1.5;
}

.ub-sig-code {
	margin: 0 0 4px;
}

.ub-sigpad {
	margin: 14px 0 8px;
	max-width: 640px;
}

.ub-sigpad-frame {
	position: relative;
	margin-top: 4px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background: #fff;
}

.ub-sigpad-canvas {
	display: block;
	width: 100%;
	height: 180px;
	cursor: crosshair;
	touch-action: none;
}

.ub-sigpad-baseline {
	position: absolute;
	left: 6%;
	right: 6%;
	bottom: 38px;
	border-bottom: 1px dashed #c3c4c7;
	pointer-events: none;
}

.ub-sigpad-hint {
	position: absolute;
	left: 0;
	right: 0;
	top: 42%;
	text-align: center;
	color: #a7aaad;
	pointer-events: none;
	font-size: 14px;
}

.ub-sigpad-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 4px;
}

.ub-consent {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	max-width: 760px;
	margin: 12px 0;
	font-size: 13px;
	line-height: 1.5;
}

.ub-consent input {
	margin-top: 3px;
	flex: none;
}

.ub-signing .ub-ok {
	color: #007017;
}

.ub-inline-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	align-items: center;
	margin: 8px 0 16px;
}

.ub-quote {
	margin: 6px 0 8px;
	padding: 8px 12px;
	border-left: 3px solid #dba617;
	background: #fff;
}

.ub-steps ol {
	margin: 0 0 6px 20px;
}

@media (max-width: 782px) {
	.ub-sigpad-canvas {
		height: 160px;
	}
}

/* ---------- Verwijderen ---------- */
.ub-delete-form {
	display: inline;
	margin: 0;
}

.ub-row-actions {
	white-space: nowrap;
	text-align: right;
}

.ub-row-actions .button-link {
	font-size: 12px;
}

.ub-danger-zone {
	margin: 10px 0 4px;
}

.ub-cancel hr {
	border: 0;
	border-top: 1px solid #dcdcde;
	margin: 16px 0;
}

/* ---------- Instellingen ---------- */
.ub-section-title {
	font-size: 18px;
	margin: 8px 0 12px;
}

.ub-card-help {
	margin: -6px 0 12px;
}

.ub-ok-line {
	color: #007017;
	font-weight: 600;
}

.ub-cat-table td {
	vertical-align: top;
}

.ub-cat-table .ub-cat-label input {
	width: 100%;
	min-width: 180px;
}

.ub-cat-order {
	white-space: nowrap;
	width: 52px;
}

.ub-cat-order .button-link {
	text-decoration: none;
	font-size: 15px;
	padding: 2px 4px;
}

.ub-cat-requires {
	min-width: 220px;
}

.ub-check-inline {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin: 0 12px 4px 0;
	font-weight: 400 !important;
	white-space: nowrap;
}

.ub-cat-row.is-inactive .ub-cat-label input {
	color: #8c8f94;
	text-decoration: line-through;
}

.ub-dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	margin-left: 6px;
	border-radius: 50%;
	background: #d63638;
	color: #fff;
	font-size: 11px;
	line-height: 1;
}

/* ---------- Eenvoudige invoer ---------- */
.ub-grid--quick {
	grid-template-columns: 90px minmax(200px, 3fr) minmax(130px, 1fr) minmax(110px, 1fr) auto;
	align-items: start;
	gap: 8px 12px;
}

.ub-grid--quick .ub-field--card_name {
	grid-column: auto;
}

.ub-field--toggle {
	align-self: start;
}

.ub-details-toggle.button {
	white-space: nowrap;
}

.ub-details-toggle::after {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-left: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
	transition: transform 0.15s ease;
}

.ub-line.is-open .ub-details-toggle::after {
	transform: translateY(1px) rotate(225deg);
}

.ub-details-count {
	font-weight: 600;
}

.ub-line-details {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px dashed #dcdcde;
}

.ub-line-details[hidden] {
	display: none;
}

.ub-field.is-required > label::after {
	content: " *";
	color: #d63638;
}

.ub-card-tools {
	display: inline-flex;
	gap: 14px;
	align-items: baseline;
}

.ub-line-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
}

.ub-manage-link {
	margin-left: auto;
}

@media (max-width: 782px) {
	.ub-grid--quick {
		grid-template-columns: 70px 1fr 1fr;
	}

	.ub-grid--quick .ub-field--card_name {
		grid-column: 2 / -1;
	}

	.ub-grid--quick .ub-field--toggle .ub-label {
		display: none;
	}
}
