/* WP Invoice Generator — front end
   Scoped to .wig so it never leaks into the theme. */

.wig {
	--wig-accent: #2563eb;
	--wig-ink: #0f172a;
	--wig-muted: #64748b;
	--wig-line: #e2e8f0;
	--wig-surface: #f8fafc;
	--wig-radius: 10px;
	--wig-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	font-family: var(--wig-ui);
	color: var(--wig-ink);
	font-size: 15px;
	line-height: 1.5;
	max-width: 1240px;
	margin: 0 auto;
	box-sizing: border-box;
}

.wig *,
.wig *::before,
.wig *::after {
	box-sizing: border-box;
}

.wig-title {
	margin: 0 0 18px;
	font-size: 1.6rem;
	letter-spacing: -0.02em;
}

/* ---------- Toolbar ---------- */

.wig-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: flex-end;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--wig-surface);
	border: 1px solid var(--wig-line);
	border-radius: var(--wig-radius);
	margin-bottom: 18px;
}

.wig-toolbar__left,
.wig-toolbar__right {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: flex-end;
}

.wig-mini {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wig-muted);
	font-weight: 600;
}

.wig-mini select {
	min-width: 130px;
}

.wig-mini--color input[type="color"] {
	width: 44px;
	height: 36px;
	padding: 2px;
	border: 1px solid var(--wig-line);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}

/* ---------- Controls ---------- */

.wig input[type="text"],
.wig input[type="email"],
.wig input[type="number"],
.wig input[type="date"],
.wig select,
.wig textarea {
	width: 100%;
	font: inherit;
	font-size: 14px;
	color: var(--wig-ink);
	background: #fff;
	border: 1px solid var(--wig-line);
	border-radius: 8px;
	padding: 9px 11px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.wig select {
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 11px center;
	background-size: 10px;
	padding-right: 30px;
}

.wig textarea {
	resize: vertical;
	min-height: 68px;
}

.wig input:focus,
.wig select:focus,
.wig textarea:focus {
	outline: none;
	border-color: var(--wig-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wig-accent) 18%, transparent);
}

.wig :focus-visible {
	outline: 2px solid var(--wig-accent);
	outline-offset: 2px;
}

/* ---------- Buttons ---------- */

.wig-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	padding: 10px 16px;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
	text-decoration: none;
}

.wig-btn:active {
	transform: translateY(1px);
}

.wig-btn--primary {
	background: var(--wig-accent);
	color: #fff;
}

.wig-btn--primary:hover {
	filter: brightness(0.93);
}

.wig-btn--ghost {
	background: #fff;
	border-color: var(--wig-line);
	color: var(--wig-ink);
}

.wig-btn--ghost:hover {
	border-color: var(--wig-muted);
}

.wig-btn--lg {
	padding: 13px 26px;
	font-size: 15px;
}

.wig-btn--file {
	display: inline-flex;
}

.wig-linkbtn {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--wig-accent);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.wig-linkbtn--add {
	margin-top: 12px;
	font-size: 14px;
	text-decoration: none;
}

/* ---------- Layout ---------- */

.wig-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
	gap: 24px;
	/* Deliberately NOT align-items: start. The preview column has to be as
	   tall as the form column, otherwise the sticky sheet inside it has no
	   room to travel and simply scrolls away with the page. */
	align-items: stretch;
}

.wig-form {
	align-self: start;
}

.wig-previewpane {
	align-self: stretch;
	position: relative;
}

.wig-card {
	background: #fff;
	border: 1px solid var(--wig-line);
	border-radius: var(--wig-radius);
	padding: 20px;
	margin-bottom: 16px;
}

.wig-card__title {
	margin: 0 0 16px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--wig-muted);
}

.wig-row {
	display: grid;
	gap: 14px;
	margin-bottom: 14px;
}

.wig-row--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wig-row--3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wig-field {
	display: block;
	margin-bottom: 14px;
}

.wig-row .wig-field {
	margin-bottom: 0;
}

.wig-field > span {
	display: block;
	margin-bottom: 5px;
	font-size: 12px;
	font-weight: 600;
	color: var(--wig-muted);
}

.wig-hint {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--wig-muted);
}

.wig-check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
	color: var(--wig-ink);
	margin: 4px 0 14px;
	cursor: pointer;
}

.wig-check input {
	width: 16px;
	height: 16px;
	accent-color: var(--wig-accent);
	margin: 0;
}

.wig-combo {
	display: flex;
	gap: 6px;
}

.wig-combo select {
	max-width: 92px;
	flex: 0 0 auto;
}

.wig-combo__label {
	max-width: 90px;
	flex: 0 0 auto;
}

.wig-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- Logo ---------- */

.wig-logo-field {
	display: flex;
	gap: 16px;
	align-items: center;
	margin-bottom: 18px;
}

.wig-logo-preview {
	width: 96px;
	height: 66px;
	flex: 0 0 auto;
	border: 1px dashed var(--wig-line);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wig-surface);
	font-size: 11px;
	color: var(--wig-muted);
	overflow: hidden;
}

.wig-logo-preview img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* ---------- Items ---------- */

.wig-items__head,
.wig-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 74px 100px 100px 32px;
	gap: 8px;
	align-items: center;
}

.wig-items__head {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wig-muted);
	padding-bottom: 8px;
	border-bottom: 1px solid var(--wig-line);
	margin-bottom: 10px;
}

.wig-items__head span:nth-child(2),
.wig-items__head span:nth-child(3),
.wig-items__head span:nth-child(4) {
	text-align: right;
}

.wig-item {
	margin-bottom: 8px;
}

.wig-item__qty,
.wig-item__rate {
	text-align: right;
}

.wig-item__amount {
	text-align: right;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	font-size: 14px;
	padding-right: 2px;
}

.wig-item__tag {
	display: none;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wig-muted);
}

.wig-item__remove {
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--wig-muted);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.wig-item__remove:hover {
	background: #fee2e2;
	color: #b91c1c;
}

/* ---------- Totals in the form ---------- */

.wig-totals {
	margin: 18px 0 0;
	padding-top: 14px;
	border-top: 1px solid var(--wig-line);
}

.wig-totals__row {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	padding: 5px 0;
	font-size: 14px;
	color: var(--wig-muted);
}

.wig-totals__row dt,
.wig-totals__row dd {
	margin: 0;
}

.wig-totals__row dd {
	font-variant-numeric: tabular-nums;
}

.wig-totals__row.is-strong {
	color: var(--wig-ink);
	font-weight: 700;
	font-size: 16px;
}

.wig-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

/* ---------- Preview pane ---------- */

.wig-previewpane__inner {
	position: sticky;
	top: var(--wig-sticky-top, 24px);
	display: flex;
	flex-direction: column;
	/* The pane pins itself to the viewport; the sheet inside it scrolls, so a
	   long invoice stays visible while you keep typing in the form. */
	max-height: calc(100vh - var(--wig-sticky-top, 24px) - 24px);
	/* Keeps the sheet a sensible size when the form is still short, and lets
	   the grid row grow with it so nothing spills out of the column. */
	min-height: 460px;
}

.wig-previewpane__label {
	margin: 0 0 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--wig-muted);
}

.wig-paper {
	background: #fff;
	border: 1px solid var(--wig-line);
	border-radius: 4px;
	box-shadow: 0 14px 40px -20px rgba(15, 23, 42, 0.35);
	padding: 34px 30px 30px;
	position: relative;
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	flex: 1 1 auto;
	min-height: 0;
	font-size: 12px;
	color: var(--wig-ink);
}

.wig-paper::-webkit-scrollbar {
	width: 8px;
}

.wig-paper::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 4px;
}

.wig-paper::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}


.wig-paper__band {
	position: absolute;
	inset: 0 0 auto 0;
	height: 5px;
	background: var(--wig-accent);
}

.wig-paper[data-template="minimal"] .wig-paper__band {
	display: none;
}

.wig-paper[data-template="bold"] .wig-paper__band {
	height: 96px;
}

.wig-paper[data-template="bold"] .wig-paper__head {
	position: relative;
	z-index: 1;
	color: #fff;
	min-height: 62px;
}

.wig-paper[data-template="bold"] .wig-paper__title h1,
.wig-paper[data-template="bold"] .wig-paper__wordmark,
.wig-paper[data-template="bold"] .wig-paper__meta b {
	color: #fff;
}

.wig-paper[data-template="bold"] .wig-paper__meta span {
	color: rgba(255, 255, 255, 0.75);
}

.wig-paper__head {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	align-items: flex-start;
	margin-bottom: 26px;
}

.wig-paper__logo img {
	max-width: 150px;
	max-height: 62px;
	object-fit: contain;
}

.wig-paper__wordmark {
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.wig-paper__title {
	text-align: right;
}

.wig-paper__title h1 {
	margin: 0 0 8px;
	font-size: 22px;
	line-height: 1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--wig-accent);
}

.wig-paper__meta div {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	font-size: 11px;
	padding: 1px 0;
}

.wig-paper__meta span {
	color: var(--wig-muted);
}

.wig-paper__meta b {
	font-variant-numeric: tabular-nums;
}

.wig-paper__parties {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 22px;
	margin-bottom: 24px;
}

.wig-paper__label {
	display: block;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wig-muted);
	margin-bottom: 4px;
}

.wig-paper__parties b {
	font-size: 13px;
}

.wig-paper__parties p {
	margin: 2px 0 0;
	color: var(--wig-muted);
	line-height: 1.45;
}

.wig-paper__table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 16px;
}

.wig-paper__table th {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wig-muted);
	text-align: left;
	padding: 7px 8px;
	background: #f1f5f9;
	background: color-mix(in srgb, var(--wig-accent) 9%, #fff);
}

.wig-paper[data-template="minimal"] .wig-paper__table th {
	background: none;
	border-bottom: 1px solid var(--wig-ink);
	padding-left: 0;
	padding-right: 0;
}

.wig-paper__table td {
	padding: 8px;
	border-bottom: 1px solid var(--wig-line);
	vertical-align: top;
}

.wig-paper[data-template="minimal"] .wig-paper__table td:first-child {
	padding-left: 0;
}

.wig-paper[data-template="minimal"] .wig-paper__table td:last-child {
	padding-right: 0;
}

.wig-paper__table .n {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.wig-paper__table tbody tr:last-child td {
	border-bottom: 0;
}

.wig-paper__empty td {
	color: var(--wig-muted);
	font-style: italic;
	text-align: center;
	padding: 22px 8px;
}

.wig-paper__totals {
	margin-left: auto;
	width: 62%;
	max-width: 260px;
}

.wig-paper__totals div {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 4px 0;
	color: var(--wig-muted);
}

.wig-paper__totals b {
	font-variant-numeric: tabular-nums;
	color: var(--wig-ink);
}

.wig-paper__totals .is-strong {
	color: var(--wig-ink);
	font-weight: 700;
	border-top: 1px solid var(--wig-line);
	margin-top: 4px;
	padding-top: 8px;
}

.wig-paper__totals .is-final {
	margin-top: 6px;
	padding: 9px 11px;
	border-top: 0;
	border-radius: 6px;
	background: #f1f5f9;
	background: color-mix(in srgb, var(--wig-accent) 10%, #fff);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wig-accent) 22%, transparent),
		0 6px 14px -8px color-mix(in srgb, var(--wig-accent) 55%, transparent);
	color: var(--wig-ink);
}

.wig-paper__totals .is-final b {
	color: var(--wig-accent);
	font-size: 15px;
}

.wig-totals__row.is-final {
	margin-top: 8px;
	padding: 10px 12px;
	border-radius: 8px;
	background: #f1f5f9;
	background: color-mix(in srgb, var(--wig-accent) 10%, #fff);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wig-accent) 22%, transparent),
		0 8px 18px -12px color-mix(in srgb, var(--wig-accent) 65%, transparent);
}

.wig-totals__row.is-final dd {
	color: var(--wig-accent);
}

.wig-paper__foot {
	margin-top: 26px;
	padding-top: 16px;
	border-top: 1px solid var(--wig-line);
	display: grid;
	gap: 14px;
}

.wig-paper__foot p {
	margin: 0;
	color: var(--wig-muted);
	line-height: 1.5;
}

.wig-paper__sign {
	margin-top: 30px;
	text-align: right;
}

.wig-paper__sign span {
	display: block;
	margin-left: auto;
	width: 150px;
	border-top: 1px solid var(--wig-ink);
}

.wig-paper__sign p {
	margin: 5px 0 0;
	font-size: 11px;
	color: var(--wig-muted);
}

/* ---------- Mobile action bar ---------- */

.wig-mobilebar {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9998;
	gap: 10px;
	padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
	background: rgba(255, 255, 255, 0.94);
	backdrop-filter: blur(8px);
	border-top: 1px solid var(--wig-line);
	box-shadow: 0 -6px 20px -14px rgba(15, 23, 42, 0.5);
	transition: transform 0.2s ease;
}

/* Slides away once the tool itself is off screen, so it does not sit over
   the rest of the page. */
.wig-mobilebar.is-hidden {
	transform: translateY(130%);
}

.wig-mobilebar .wig-btn {
	flex: 1 1 auto;
	min-height: 46px;
}

.wig-mobilebar .wig-btn--ghost {
	flex: 0 0 auto;
	min-width: 104px;
}

/* ---------- Status ---------- */

.wig-status {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 130%);
	z-index: 9999;
	background: var(--wig-ink);
	color: #fff;
	font-size: 14px;
	padding: 12px 20px;
	border-radius: 999px;
	box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.6);
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
	max-width: 90vw;
	text-align: center;
}

.wig-status.is-visible {
	transform: translate(-50%, 0);
	opacity: 1;
}

.wig-status.is-success {
	background: #14532d;
}

.wig-status.is-error {
	background: #7f1d1d;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.wig-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.wig-previewpane {
		order: 2;
	}

	.wig-previewpane__inner {
		position: static;
		max-height: none;
		min-height: 0;
		display: block;
	}

	.wig-paper {
		overflow: visible;
		min-height: 420px;
	}

	/* The fixed bar covers the bottom of the page, so give the content
	   somewhere to end. */
	.wig {
		padding-bottom: 78px;
	}

	.wig-mobilebar {
		display: flex;
	}

	.wig-status {
		bottom: 84px;
	}
}

@media (max-width: 640px) {
	.wig {
		font-size: 15px;
	}

	/* iOS Safari zooms the whole page in when a focused field is under 16px.
	   Everything the thumb can land in is bumped to 16px on small screens. */
	.wig input[type="text"],
	.wig input[type="email"],
	.wig input[type="number"],
	.wig input[type="date"],
	.wig select,
	.wig textarea {
		font-size: 16px;
		padding: 11px 12px;
	}

	.wig-toolbar {
		flex-direction: column;
		align-items: stretch;
		padding: 12px;
		gap: 12px;
	}

	.wig-toolbar__left {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 64px;
		gap: 10px;
	}

	.wig-mini:first-child {
		grid-column: 1 / -1;
	}

	.wig-mini select {
		min-width: 0;
		width: 100%;
	}

	.wig-mini--color input[type="color"] {
		width: 100%;
		height: 44px;
	}

	.wig-toolbar__right {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.wig-toolbar__right .wig-btn {
		min-height: 44px;
	}

	/* The download button lives in the fixed bar on mobile; two of them
	   side by side is just noise. */
	#wig-download {
		display: none;
	}

	.wig-card {
		padding: 16px 14px;
	}

	.wig-row--2,
	.wig-row--3 {
		grid-template-columns: minmax(0, 1fr);
	}

	.wig-combo {
		flex-wrap: wrap;
	}

	.wig-combo__label {
		max-width: none;
		flex: 1 1 100%;
	}

	.wig-combo input[type="number"] {
		flex: 1 1 0;
	}

	.wig-combo select {
		max-width: 108px;
	}

	.wig-logo-field {
		align-items: flex-start;
	}

	.wig-logo-preview {
		width: 80px;
		height: 60px;
	}

	.wig-items__head {
		display: none;
	}

	.wig-item {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
		grid-template-areas:
			"desc desc remove"
			"qtag rtag ."
			"qty rate amount";
		row-gap: 4px;
		column-gap: 10px;
		align-items: center;
		padding-bottom: 14px;
		border-bottom: 1px solid var(--wig-line);
		margin-bottom: 14px;
	}

	.wig-item__desc { grid-area: desc; }
	.wig-item__tag--qty { grid-area: qtag; }
	.wig-item__tag--rate { grid-area: rtag; }
	.wig-item__qty { grid-area: qty; }
	.wig-item__rate { grid-area: rate; }
	.wig-item__amount { grid-area: amount; min-width: 76px; }
	.wig-item__remove { grid-area: remove; }

	.wig-item__tag {
		display: block;
		padding-top: 4px;
	}

	.wig-item__remove {
		width: 38px;
		height: 38px;
		font-size: 24px;
	}

	.wig-actions .wig-btn {
		flex: 1 1 auto;
		min-height: 46px;
	}

	.wig-paper {
		padding: 22px 16px;
		font-size: 11.5px;
	}

	.wig-paper__head {
		flex-direction: column;
		gap: 14px;
		margin-bottom: 20px;
	}

	.wig-paper__title {
		text-align: left;
	}

	.wig-paper__meta div {
		justify-content: flex-start;
	}

	.wig-paper__parties {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	/* Long item descriptions must wrap rather than push the sheet sideways. */
	.wig-paper__table {
		table-layout: fixed;
	}

	.wig-paper__table th,
	.wig-paper__table td {
		padding: 7px 4px;
		overflow-wrap: anywhere;
	}

	.wig-paper__table th:first-child,
	.wig-paper__table td:first-child {
		width: 44%;
	}

	.wig-paper__totals {
		width: 100%;
		max-width: none;
	}

	.wig-paper__plan td {
		padding: 6px 4px 6px 0;
		overflow-wrap: anywhere;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wig * {
		transition: none !important;
	}
}

/* ---------- Instalment plan ---------- */

.wig-plan {
	margin-top: 6px;
}

.wig-planrow {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 150px 110px 74px 32px;
	gap: 8px;
	align-items: center;
	margin-bottom: 8px;
}

.wig-planrow__amount {
	text-align: right;
}

.wig-planrow__paid {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--wig-muted);
	cursor: pointer;
	white-space: nowrap;
}

.wig-planrow__paid input {
	width: 15px;
	height: 15px;
	margin: 0;
	accent-color: var(--wig-accent);
}

.wig-plan__check {
	margin: 12px 0 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--wig-muted);
	min-height: 20px;
}

.wig-plan__check.is-ok {
	color: #15803d;
}

.wig-plan__check.is-warn {
	color: #b45309;
}

/* ---------- Status stamp on the paper ---------- */

.wig-paper__stamp {
	display: inline-block;
	margin: 0 0 8px;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	background: var(--wig-accent);
	color: #fff;
}

.wig-paper__stamp--paid {
	background: #166534;
}

.wig-paper__stamp--overdue {
	background: #991b1b;
}

.wig-paper[data-template="bold"] .wig-paper__stamp {
	background: #fff;
	color: var(--wig-accent);
}

/* ---------- Schedule on the paper ---------- */

.wig-paper__plan {
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid var(--wig-line);
}

.wig-paper__plan table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 6px;
}

.wig-paper__plan td {
	padding: 5px 6px 5px 0;
	border-bottom: 1px solid var(--wig-line);
	color: var(--wig-muted);
}

.wig-paper__plan td:first-child {
	color: var(--wig-ink);
}

.wig-paper__plan td.n {
	text-align: right;
	font-variant-numeric: tabular-nums;
	color: var(--wig-ink);
	font-weight: 600;
	white-space: nowrap;
}

.wig-paper__plan td.s {
	width: 46px;
	text-align: right;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

@media (max-width: 640px) {
	.wig-planrow {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
		grid-template-areas:
			"plabel plabel premove"
			"pdue pamount pamount"
			"ppaid ppaid ppaid";
		row-gap: 8px;
		column-gap: 10px;
		padding-bottom: 14px;
		border-bottom: 1px solid var(--wig-line);
		margin-bottom: 14px;
	}

	.wig-planrow__label { grid-area: plabel; }
	.wig-planrow__due { grid-area: pdue; }
	.wig-planrow__amount { grid-area: pamount; }
	.wig-planrow__paid { grid-area: ppaid; }
	.wig-planrow [data-premove] { grid-area: premove; }

	.wig-planrow__paid {
		font-size: 14px;
		min-height: 34px;
	}

	.wig-planrow__paid input {
		width: 20px;
		height: 20px;
	}
}



/* ---------- Links inside notes / payment / terms ---------- */

.wig-paper__foot .wig-link {
	color: var(--wig-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
	font-weight: 600;
	word-break: break-word;
}

.wig-paper__foot .wig-link:hover {
	filter: brightness(0.85);
}
