.tri-invoice-builder {
	max-width: 820px;
	margin: 0 auto;
	padding: 0 4px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	color: #1f2d2d;
	line-height: 1.5;
}

.tri-invoice-builder * {
	box-sizing: border-box;
}

.tri-section-title {
	font-size: 18px;
	margin: 32px 0 12px;
	color: #2d5a5a;
	border-bottom: 2px solid #e2e8e8;
	padding-bottom: 6px;
}

.tri-section-title:first-of-type {
	margin-top: 0;
}

.tri-hp-wrap {
	position: absolute;
	left: -9999px;
	top: -9999px;
	height: 0;
	overflow: hidden;
}

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

.tri-items-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 12px;
}

.tri-items-table th {
	text-align: left;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #5a6b6b;
	padding: 8px 6px;
	border-bottom: 2px solid #e2e8e8;
}

.tri-items-table td {
	padding: 8px 6px;
	vertical-align: middle;
}

.tri-col-qty {
	width: 90px;
}

.tri-col-price, .tri-col-total {
	width: 120px;
}

.tri-col-remove {
	width: 44px;
}

.tri-items-table input[type="text"],
.tri-items-table input[type="number"],
.tri-items-table select {
	width: 100%;
	padding: 10px 8px;
	border: 1px solid #cdd9d9;
	border-radius: 6px;
	font-size: 16px;
	background: #fff;
	font-family: inherit;
}

.tri-desc-custom {
	margin-top: 6px;
}

.tri-line-total {
	font-weight: 600;
	text-align: right;
	padding-right: 12px !important;
	white-space: nowrap;
}

.tri-remove-row {
	background: none;
	border: none;
	color: #b04a4a;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 10px;
	min-width: 44px;
	min-height: 44px;
}

.tri-btn {
	display: inline-block;
	border: none;
	border-radius: 6px;
	padding: 13px 20px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	min-height: 44px;
}

.tri-btn-secondary {
	background: #e2e8e8;
	color: #2d5a5a;
}

.tri-btn-secondary:hover {
	background: #d3dede;
}

.tri-btn-primary {
	background: #2d5a5a;
	color: #fff;
	margin-top: 24px;
	width: 100%;
	font-size: 16px;
	padding: 15px 20px;
}

.tri-btn-primary:hover {
	background: #234747;
}

.tri-btn-primary:disabled,
.tri-btn-secondary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.tri-totals {
	background: #f6f8f8;
	border-radius: 8px;
	padding: 16px 20px;
	margin: 8px 0 24px;
}

.tri-totals-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 6px 0;
	font-size: 14px;
}

.tri-totals-main {
	font-size: 17px;
	border-bottom: 1px solid #dbe4e4;
	margin-bottom: 6px;
	padding-bottom: 10px;
}

.tri-delivery-box {
	background: #f6f8f8;
	border-radius: 8px;
	padding: 16px 20px;
	margin-bottom: 8px;
}

.tri-delivery-box .tri-grid {
	align-items: end;
}

.tri-field-button {
	justify-content: flex-end;
}

.tri-field-button .tri-btn {
	width: 100%;
}

.tri-delivery-result {
	background: #fff;
	border: 1px solid #dbe4e4;
	border-radius: 6px;
	padding: 10px 14px;
	font-size: 14px;
	margin: 12px 0 4px;
}

.tri-delivery-box .description {
	font-size: 13px;
	color: #5a6b6b;
	margin-bottom: 0;
}

.tri-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 16px;
}

.tri-field {
	display: flex;
	flex-direction: column;
}

.tri-field-wide {
	grid-column: 1 / -1;
}

.tri-field label {
	font-size: 13px;
	font-weight: 600;
	color: #5a6b6b;
	margin-bottom: 6px;
}

.tri-field input,
.tri-field textarea {
	padding: 12px 10px;
	border: 1px solid #cdd9d9;
	border-radius: 6px;
	font-size: 16px;
	font-family: inherit;
}

.tri-notice {
	background: #fdeceb;
	border: 1px solid #eab4ae;
	color: #8a2e24;
	padding: 12px 16px;
	border-radius: 6px;
	margin-bottom: 16px;
}

.tri-success {
	background: #eaf6ef;
	border: 1px solid #a9d9bd;
	color: #1e5c3a;
	padding: 16px 20px;
	border-radius: 8px;
	margin-top: 24px;
}

.tri-success h3 {
	margin-top: 0;
}

.tri-success .tri-btn-secondary {
	width: 100%;
	text-align: center;
}

/* ---------------------------------------------------------------------
 * Mobile: stack the item table into labelled cards instead of squeezing
 * five columns into a narrow viewport.
 * ------------------------------------------------------------------- */
@media ( max-width: 680px ) {
	.tri-invoice-builder {
		padding: 0 2px;
	}

	.tri-section-title {
		font-size: 16px;
	}

	.tri-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.tri-field-button .tri-btn {
		margin-top: 4px;
	}

	.tri-items-table thead {
		display: none;
	}

	.tri-items-table,
	.tri-items-table tbody,
	.tri-items-table tr,
	.tri-items-table td {
		display: block;
		width: 100%;
	}

	.tri-item-row {
		border: 1px solid #e2e8e8;
		border-radius: 8px;
		padding: 12px;
		margin-bottom: 14px;
		background: #fbfcfc;
	}

	.tri-items-table td {
		padding: 6px 0;
	}

	.tri-items-table td[data-label]::before {
		content: attr(data-label);
		display: block;
		font-size: 12px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.03em;
		color: #5a6b6b;
		margin-bottom: 4px;
	}

	.tri-line-total {
		text-align: left !important;
		padding-right: 0 !important;
		font-size: 16px;
	}

	.tri-col-remove {
		width: 100%;
		text-align: right;
	}

	.tri-remove-row {
		border: 1px solid #eab4ae;
		border-radius: 6px;
		width: 100%;
		font-size: 15px;
	}

	.tri-remove-row::before {
		content: 'Remove line';
		font-size: 14px;
		font-weight: 600;
		margin-right: 4px;
	}

	.tri-btn {
		width: 100%;
		text-align: center;
	}

	.tri-totals-row {
		font-size: 15px;
	}
}
