@import url("https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,500&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

/* ===================================================================
   UAE Accounting Tools — front-end styles
   Drop-in replacement for assets/css/uat-tools.css
   Same class names as v1.1.0: no PHP or JS changes required.

   Palette   ink #131C1A · paper #F6F4EF · rule #DED9D0
             green #0B5C48 · gold #B0854A · muted #6B7671
   Type      Newsreader (headings) · IBM Plex Sans (UI) · IBM Plex Mono (figures)
   =================================================================== */

/* --- Card ---------------------------------------------------------- */

.uat-tool-card {
	max-width: 880px;
	margin: 0 0 40px;
	padding: 32px 32px 30px;
	border: 1px solid #ded9d0;
	border-radius: 0;
	background: #fff;
	box-shadow: none;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	color: #131c1a;
	scroll-margin-top: 24px;
}

.uat-tool-title {
	margin: 0 0 10px;
	font-family: "Newsreader", Georgia, serif;
	font-size: 30px;
	font-weight: 400;
	line-height: 1.12;
	letter-spacing: -0.02em;
	color: #131c1a;
}

.uat-tool-intro {
	max-width: 62ch;
	margin: 0 0 28px;
	font-size: 15px;
	line-height: 1.6;
	color: #58635e;
	text-wrap: pretty;
}

/* --- Form ---------------------------------------------------------- */

.uat-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	gap: 20px 24px;
	margin-bottom: 0;
}

.uat-field,
.uat-field-wide {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.uat-field label,
.uat-field-wide label {
	margin-bottom: 8px;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: #6b7671;
}

.uat-field input[type="number"],
.uat-field input[type="text"],
.uat-field input[type="date"],
.uat-field select,
.uat-field-wide input[type="text"],
.uat-field-wide textarea {
	height: 48px;
	padding: 0 14px;
	border: 1px solid #ded9d0;
	border-radius: 0;
	background: #fbfaf7;
	color: #131c1a;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 15px;
	transition: border-color 0.14s ease, background 0.14s ease;
	-webkit-appearance: none;
	appearance: none;
}

/* Figures read as figures. */
.uat-field input[type="number"],
.uat-field input[type="date"],
.uat-field-wide input[type="number"] {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 17px;
	text-align: right;
}

.uat-field input[type="date"] {
	text-align: left;
	font-size: 15px;
}

.uat-field select {
	background-image: linear-gradient(45deg, transparent 50%, #6b7671 50%), linear-gradient(135deg, #6b7671 50%, transparent 50%);
	background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: 38px;
}

.uat-field-wide textarea {
	height: auto;
	min-height: 76px;
	padding: 12px 14px;
	line-height: 1.5;
	resize: vertical;
}

.uat-field input:hover,
.uat-field select:hover {
	background: #fff;
}

.uat-field input:focus,
.uat-field select:focus,
.uat-field-wide input:focus,
.uat-field-wide textarea:focus {
	outline: 0;
	border-color: #0b5c48;
	box-shadow: inset 0 0 0 1px #0b5c48;
	background: #fff;
}

/* Checkbox rows */
.uat-field-checkbox {
	grid-column: 1 / -1;
	flex-direction: row;
	align-items: flex-start;
}

.uat-field-checkbox label,
.uat-field > label:has(input[type="checkbox"]) {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.45;
	letter-spacing: 0;
	text-transform: none;
	color: #131c1a;
	cursor: pointer;
}

.uat-field input[type="checkbox"] {
	flex: 0 0 auto;
	width: 19px;
	height: 19px;
	margin: 1px 0 0;
	border: 1px solid #c9c3b8;
	border-radius: 0;
	background: #fbfaf7;
	accent-color: #0b5c48;
	cursor: pointer;
}

.uat-hint {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: #8c948f;
}

/* --- Primary action ------------------------------------------------ */

.uat-btn {
	grid-column: 1 / -1;
	justify-self: start;
	margin-top: 6px;
	padding: 0 26px;
	height: 48px;
	border: 0;
	border-radius: 0;
	background: #131c1a;
	color: #f6f4ef;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background 0.14s ease;
}

.uat-btn:hover,
.uat-btn:focus-visible {
	background: #0b5c48;
	outline: 0;
}

.uat-btn-secondary {
	height: 42px;
	padding: 0 18px;
	border: 1px solid #131c1a;
	border-radius: 0;
	background: transparent;
	color: #131c1a;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.14s ease, color 0.14s ease;
}

.uat-btn-secondary:hover {
	background: #131c1a;
	color: #f6f4ef;
}

/* --- Result panel: full-bleed ink block ---------------------------- */

.uat-result {
	margin: 32px -32px 0;
	padding: 30px 32px 34px;
	border: 0;
	background: #131c1a;
}

.uat-result-grid {
	display: block;
}

.uat-result-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 20px;
	padding: 11px 0;
	border: 0;
	border-top: 1px solid rgba(246, 244, 239, 0.1);
	border-radius: 0;
	background: transparent;
}

.uat-result-row:last-of-type {
	border-bottom: 1px solid rgba(246, 244, 239, 0.1);
}

.uat-result-label {
	font-size: 13px;
	line-height: 1.4;
	color: #a8b0ab;
}

.uat-result-value {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	color: #e8e4db;
	white-space: nowrap;
}

/* The headline figure */
.uat-result-row.uat-highlight {
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	padding: 18px 0 20px;
	background: transparent;
	border-color: rgba(246, 244, 239, 0.1);
	font-weight: 400;
}

.uat-result-row.uat-highlight .uat-result-label {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #8c948f;
}

.uat-result-row.uat-highlight .uat-result-value {
	font-size: 34px;
	font-weight: 500;
	letter-spacing: -0.03em;
	color: #f6f4ef;
}

.uat-result-row.uat-highlight:first-child {
	padding-top: 0;
	border-top: 0;
}

/* Warnings speak in gold, not in coloured boxes. */
.uat-result-row.uat-warn {
	background: transparent;
	border-color: rgba(176, 133, 74, 0.4);
}

.uat-result-row.uat-warn .uat-result-label,
.uat-result-row.uat-warn .uat-result-value {
	color: #cfa062;
}

.uat-result-note {
	max-width: 68ch;
	margin: 22px 0 0;
	font-size: 12px;
	line-height: 1.65;
	color: #7d857f;
	text-wrap: pretty;
}

/* --- Disclaimer ---------------------------------------------------- */

.uat-disclaimer {
	max-width: 76ch;
	margin: 24px 0 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: #8c948f;
	font-size: 12px;
	line-height: 1.65;
	text-wrap: pretty;
}

/* ===================================================================
   Invoice generator
   =================================================================== */

.uat-invoice-section {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px 24px;
	padding-top: 4px;
}

.uat-invoice-section h3,
.uat-field-wide h3 {
	grid-column: 1 / -1;
	margin: 0 0 2px;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #b0854a;
}

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

.uat-invoice-items-wrap {
	margin-bottom: 14px;
	overflow-x: auto;
}

.uat-invoice-items {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
}

.uat-invoice-items th {
	padding: 0 8px 8px 0;
	border-bottom: 1px solid #ded9d0;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	text-align: left;
	color: #8c948f;
}

.uat-invoice-items td {
	padding: 6px 8px 6px 0;
	vertical-align: middle;
}

.uat-invoice-items input,
.uat-invoice-items select {
	width: 100%;
	height: 44px;
	padding: 0 12px;
	border: 1px solid #ded9d0;
	border-radius: 0;
	background: #fbfaf7;
	color: #131c1a;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 14px;
}

.uat-invoice-items input[type="number"] {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	text-align: right;
}

.uat-invoice-items input:focus,
.uat-invoice-items select:focus {
	outline: 0;
	border-color: #0b5c48;
	box-shadow: inset 0 0 0 1px #0b5c48;
	background: #fff;
}

.uat-remove-row {
	width: 34px;
	height: 44px;
	border: 1px solid #ded9d0;
	border-radius: 0;
	background: none;
	color: #8c948f;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.14s ease, border-color 0.14s ease;
}

.uat-remove-row:hover {
	color: #b4483a;
	border-color: #b4483a;
}

.uat-btn-print {
	margin-top: 22px;
	background: #b0854a;
	color: #131c1a;
}

.uat-btn-print:hover,
.uat-btn-print:focus-visible {
	background: #c79a5c;
}

/* --- The printed document: a white sheet on the ink panel ---------- */

.uat-invoice-doc {
	padding: 44px 46px 46px;
	border: 0;
	border-radius: 0;
	background: #fff;
	color: #131c1a;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.uat-invoice-doc-header {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 24px 40px;
	margin-bottom: 24px;
	padding-bottom: 24px;
	border-bottom: 2px solid #131c1a;
	font-size: 13px;
	line-height: 1.65;
	color: #58635e;
}

.uat-invoice-doc-title {
	margin-bottom: 10px;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #b0854a;
}

.uat-invoice-doc-header > div > div:nth-child(2) {
	font-family: "Newsreader", Georgia, serif;
	font-size: 24px;
	line-height: 1.15;
	letter-spacing: -0.015em;
	color: #131c1a;
}

.uat-invoice-doc-meta {
	text-align: right;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 12px;
	line-height: 1.8;
	color: #58635e;
}

.uat-invoice-doc-parties {
	margin-bottom: 26px;
	font-size: 13px;
	line-height: 1.7;
	color: #58635e;
}

.uat-invoice-doc-parties strong {
	display: block;
	margin-bottom: 6px;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #8c948f;
}

.uat-invoice-doc-table {
	width: 100%;
	margin-bottom: 24px;
	border-collapse: collapse;
}

.uat-invoice-doc-table th {
	padding: 12px 8px;
	border-top: 1px solid #131c1a;
	border-bottom: 1px solid #ded9d0;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-align: left;
	color: #6b7671;
}

.uat-invoice-doc-table td {
	padding: 14px 8px;
	border-bottom: 1px solid #ebe7de;
	font-size: 14px;
	color: #131c1a;
}

.uat-invoice-doc-table th:not(:first-child),
.uat-invoice-doc-table td:not(:first-child) {
	text-align: right;
}

.uat-invoice-doc-table td:not(:first-child) {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 13px;
	color: #58635e;
}

.uat-invoice-doc-table td:last-child {
	color: #131c1a;
}

.uat-invoice-doc-totals {
	display: grid;
	gap: 0;
	max-width: 320px;
	margin-left: auto;
	font-size: 13px;
	color: #58635e;
}

.uat-invoice-doc-totals > div {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	padding: 9px 0;
}

.uat-invoice-doc-totals > div span:last-child {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	color: #131c1a;
}

.uat-invoice-doc-grand {
	align-items: baseline;
	margin-top: 6px;
	padding-top: 16px !important;
	border-top: 1px solid #ded9d0;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #6b7671;
}

.uat-invoice-doc-grand span:last-child {
	font-size: 26px;
	font-weight: 500;
	letter-spacing: -0.02em;
	text-transform: none;
}

.uat-invoice-doc-notes {
	margin-top: 36px;
	padding-top: 18px;
	border-top: 1px solid #ebe7de;
	font-size: 12px;
	line-height: 1.7;
	color: #6b7671;
	text-wrap: pretty;
}

.uat-invoice-doc-notes strong {
	color: #131c1a;
}

/* ===================================================================
   [uat_tools] — combined page: header, tool rail, panels
   =================================================================== */

.uat-tools-app {
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	color: #131c1a;
}

.uat-tools-header {
	max-width: 60ch;
	margin: 0 0 40px;
}

.uat-tools-eyebrow {
	margin: 0 0 18px;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #b0854a;
}

.uat-tools-heading {
	margin: 0 0 18px;
	font-family: "Newsreader", Georgia, serif;
	font-size: clamp(34px, 5vw, 54px);
	font-weight: 400;
	line-height: 1.04;
	letter-spacing: -0.025em;
	color: #131c1a;
}

.uat-tools-intro {
	margin: 0;
	font-size: 17px;
	line-height: 1.6;
	color: #58635e;
	text-wrap: pretty;
}

.uat-tools-body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 40px;
}

/* --- Rail ---------------------------------------------------------- */

.uat-tools-rail {
	position: sticky;
	top: 24px;
	flex: 1 1 230px;
	max-width: 262px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.uat-tools-rail-label {
	margin: 0 0 12px 2px;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #8c948f;
}

.uat-tools-nav-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 13px 14px;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: #3f4a45;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
	transition: background 0.14s ease, color 0.14s ease;
}

.uat-tools-nav-item:hover {
	background: #efebe3;
}

.uat-tools-nav-item.is-active {
	background: #131c1a;
	color: #f6f4ef;
}

.uat-tools-nav-num {
	flex: 0 0 auto;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 500;
	opacity: 0.55;
}

.uat-tools-nav-text {
	flex: 1 1 auto;
	min-width: 0;
}

.uat-tools-aside {
	margin-top: 26px;
	padding: 18px;
	border: 1px solid #ded9d0;
	background: #efebe3;
}

.uat-tools-aside p {
	margin: 0;
	font-size: 13px;
	line-height: 1.55;
	color: #58635e;
	text-wrap: pretty;
}

.uat-tools-aside a {
	display: inline-block;
	margin-top: 12px;
	padding-bottom: 3px;
	border-bottom: 1px solid #0b5c48;
	color: #0b5c48;
	font-size: 12px;
	font-weight: 500;
	text-decoration: none;
}

.uat-tools-aside a:hover {
	border-bottom-color: #b0854a;
	color: #b0854a;
}

/* --- Panels -------------------------------------------------------- */

.uat-tools-panels {
	flex: 999 1 480px;
	min-width: 0;
}

.uat-tools-panels .uat-tool-card {
	max-width: none;
	margin: 0 0 32px;
}

/* Once the rail is live only one panel shows, so it carries no margin. */
.uat-railed .uat-tools-panels .uat-tool-card {
	margin-bottom: 0;
}

.uat-panel[hidden] {
	display: none;
}

.uat-tools-footer {
	margin-top: 48px;
	padding-top: 28px;
	border-top: 1px solid #ded9d0;
}

.uat-tools-footer p {
	max-width: 68ch;
	margin: 0;
	font-size: 12px;
	line-height: 1.65;
	color: #8c948f;
	text-wrap: pretty;
}

/* --- Live mode: the Calculate button is redundant ------------------ */

.uat-live [data-action="calc"]:not(.uat-btn-print) {
	display: none;
}

/* …but the invoice still needs its print button. */
.uat-live .uat-btn-print {
	display: inline-block;
}

/* --- Narrow screens ------------------------------------------------ */

@media (max-width: 860px) {
	.uat-tools-rail {
		position: static;
		flex: 1 1 100%;
		max-width: none;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 6px;
	}

	.uat-tools-rail-label {
		flex: 1 1 100%;
		margin-bottom: 4px;
	}

	.uat-tools-nav-item {
		width: auto;
		border: 1px solid #ded9d0;
		padding: 10px 14px;
	}

	.uat-tools-nav-item.is-active {
		border-color: #131c1a;
	}

	.uat-tools-aside {
		flex: 1 1 100%;
		margin-top: 14px;
	}
}

@media (max-width: 720px) {
	.uat-tool-card {
		padding: 24px 20px 22px;
	}

	.uat-result {
		margin: 26px -20px 0;
		padding: 26px 20px 28px;
	}

	.uat-tool-title {
		font-size: 25px;
	}

	.uat-result-row.uat-highlight .uat-result-value {
		font-size: 28px;
	}

	.uat-invoice-doc {
		padding: 26px 22px 28px;
	}

	.uat-invoice-doc-meta {
		text-align: left;
	}
}

/* --- Print --------------------------------------------------------- */

@media print {
	body * {
		visibility: hidden;
	}

	.uat-invoice-preview,
	.uat-invoice-preview * {
		visibility: visible;
	}

	.uat-invoice-preview {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
	}

	.uat-invoice-doc {
		padding: 0;
		border: 0;
	}
}

/* --- Invoice logo -------------------------------------------------- */

.uat-logo-control {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
}

.uat-logo-preview {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 96px;
	height: 64px;
	padding: 8px;
	border: 1px solid #ded9d0;
	background: #fff;
}

.uat-logo-preview[hidden] {
	display: none;
}

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

.uat-logo-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
}

.uat-logo-field input[type="file"] {
	max-width: 100%;
	font-size: 13px;
	color: #58635e;
}

.uat-logo-field input[type="file"]::file-selector-button {
	margin-right: 12px;
	padding: 10px 16px;
	border: 1px solid #131c1a;
	border-radius: 0;
	background: transparent;
	color: #131c1a;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.14s ease, color 0.14s ease;
}

.uat-logo-field input[type="file"]::file-selector-button:hover {
	background: #131c1a;
	color: #f6f4ef;
}

.uat-logo-remove {
	padding: 0;
	border: 0;
	border-bottom: 1px solid #b4483a;
	background: none;
	color: #b4483a;
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 12px;
	cursor: pointer;
}

.uat-logo-remove[hidden] {
	display: none;
}

.uat-invoice-doc-logo {
	display: block;
	max-width: 180px;
	max-height: 64px;
	height: auto;
	margin-bottom: 16px;
}

@media print {
	.uat-invoice-doc-logo {
		max-height: 56px;
	}
}
