/* ==========================================================================
   Architect Area Calculator - Frontend styles
   Base layout + 11 selectable visual themes (set in Settings or per-sheet).
   ========================================================================== */

.aac-shell,
.aac-shell * {
	box-sizing: border-box;
}

.aac-card {
	--aac-bg: #f4f5f7;
	--aac-card-bg: #ffffff;
	--aac-card-border: #e5e7eb;
	--aac-radius: 10px;
	--aac-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	--aac-text: #1f2328;
	--aac-muted: #6b7280;
	--aac-accent: #2563eb;
	--aac-accent-text: #ffffff;
	--aac-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--aac-title-transform: none;
	--aac-title-letter-spacing: normal;

	max-width: 960px;
	margin: 24px auto;
	padding: 28px 32px;
	background: var(--aac-card-bg);
	border: 1px solid var(--aac-card-border);
	border-radius: var(--aac-radius);
	box-shadow: var(--aac-shadow);
	font-family: var(--aac-font);
	color: var(--aac-text);
}

.aac-error {
	color: #b32d2e;
}

/* Honeypot: positioned off-screen rather than display:none/visibility:hidden,
   since some spam bots specifically skip fields hidden that way. */
.aac-hp-field {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	margin: 0;
}

/* ---- Login gate (shown instead of the calculator for a logged-out
   visitor requesting a saved sheet by ID) ----------------------------- */

.aac-login-wrap {
	max-width: 360px;
	margin: 24px auto;
	padding: 28px 32px;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.aac-login-message {
	margin: 0 0 16px;
	font-size: 14px;
	color: #1f2328;
	text-align: center;
}

.aac-login-wrap form.login p {
	margin: 0 0 14px;
}

.aac-login-wrap form.login label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #6b7280;
	margin-bottom: 5px;
}

.aac-login-wrap form.login input[type="text"],
.aac-login-wrap form.login input[type="password"] {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 14px;
	box-sizing: border-box;
}

.aac-login-wrap form.login input[type="submit"] {
	width: 100%;
	padding: 10px;
	border: none;
	border-radius: 7px;
	background: #2563eb;
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
}

/* ---- Letterhead / company block ---------------------------------------- */

.aac-letterhead {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 2px solid var(--aac-card-border);
}

.aac-logo {
	max-height: 72px;
	max-width: 180px;
	object-fit: contain;
}

.aac-company-name {
	margin: 0 0 2px;
	font-size: 20px;
	font-weight: 700;
}

.aac-architect,
.aac-address,
.aac-contact {
	margin: 0;
	font-size: 13px;
	color: var(--aac-muted);
}

.aac-sheet-title {
	text-align: center;
	margin: 14px 0 22px;
	font-size: 22px;
	font-weight: 700;
	text-transform: var(--aac-title-transform);
	letter-spacing: var(--aac-title-letter-spacing);
}

/* ---- Header fields ------------------------------------------------------ */

.aac-header-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px 28px;
	margin-bottom: 24px;
}

.aac-field label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--aac-muted);
	margin-bottom: 5px;
}

.aac-field input:not([type="radio"]):not([type="checkbox"]) {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--aac-card-border);
	border-radius: 6px;
	font-size: 14px;
	font-family: inherit;
	background: var(--aac-card-bg);
	color: var(--aac-text);
}

/* Radios/checkboxes inside a themed .aac-field (Sheet Options, Print
   Options) must stay their normal small native size - without this, every
   theme's "style every input inside .aac-field" rule below also stretches
   them into a full-width bar, which looks broken rather than like a
   checkbox/radio. */
.aac-field input[type="radio"],
.aac-field input[type="checkbox"] {
	width: 15px;
	height: 15px;
	margin: 0;
	padding: 0;
	border-radius: initial;
	background: initial;
	box-shadow: none;
	accent-color: var(--aac-accent);
	flex: none;
}

.aac-header-grid-print .aac-field span {
	display: block;
	padding: 7px 0;
	border-bottom: 1px dashed #999;
	min-height: 1.4em;
}

/* ---- Rows table ---------------------------------------------------------- */

.aac-table-scroll {
	overflow-x: auto;
}

.aac-rows-table,
.aac-summary-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
	table-layout: fixed;
}

.aac-rows-table th,
.aac-rows-table td,
.aac-summary-table th,
.aac-summary-table td {
	border: 1px solid var(--aac-card-border);
	padding: 8px 10px;
}

.aac-rows-table thead th,
.aac-summary-table thead th {
	background: var(--aac-bg);
	text-align: left;
	font-weight: 700;
}

.aac-col-num {
	text-align: right;
	white-space: nowrap;
}

.aac-col-sn {
	width: 30px;
	text-align: center;
}

.aac-col-nos {
	width: 56px;
}

/* Area and Less/Deduction share the same width so big numbers in either
   column line up and have equal room, instead of Area being cramped or
   Less being oversized. */
.aac-col-figure {
	width: 105px;
	min-width: 105px;
	font-size: 15px;
	font-weight: 700;
}

.aac-col-dim {
	width: 110px;
}

.aac-col-category {
	width: 130px;
}

.aac-col-action {
	width: 34px;
	text-align: center;
}

.aac-rows-table input,
.aac-rows-table select {
	width: 100%;
	border: 1px solid transparent;
	background: transparent;
	font: inherit;
	color: inherit;
	padding: 4px;
	border-radius: 4px;
}

.aac-rows-table input:focus,
.aac-rows-table select:focus {
	border-color: var(--aac-accent);
	outline: none;
	background: var(--aac-card-bg);
}

.aac-rows-table .aac-input-num {
	text-align: right;
}

.aac-desc-cell .aac-desc-picker {
	margin-bottom: 4px;
	font-size: 12px;
	background: var(--aac-bg);
	border-color: var(--aac-card-border);
}

.aac-input-length,
.aac-input-width {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* "Less/Deduction" category rows: the whole row's area is a deduction. */
.aac-row-is-deduction {
	background: rgba(255, 105, 135, 0.07);
}

.aac-row-is-deduction .aac-row-area {
	color: var(--aac-muted);
	font-weight: 400;
}

.aac-col-figure.aac-less-is-deduction,
td.aac-less-is-deduction {
	background: #ffe3ea;
}

.aac-col-less.aac-less-is-deduction .aac-input-less[readonly] {
	background: transparent;
	color: #9c2b45;
	font-weight: 700;
	-webkit-text-fill-color: #9c2b45;
}

.aac-rate-cell {
	display: flex;
	align-items: center;
	gap: 4px;
	justify-content: flex-end;
}

.aac-currency {
	color: var(--aac-muted);
	font-size: 12px;
}

.aac-unit-suffix {
	font-size: 11px;
	font-weight: 400;
	color: var(--aac-muted);
}

.aac-mode-hint {
	font-size: 12px;
	color: var(--aac-muted);
	margin: -12px 0 16px;
}

/* Live totals preview - desktop only (screen space is too tight on
   mobile, and the real totals row is never far away there anyway).
   Deliberately theme-independent (fixed colours, not the --aac-* theme
   variables) since it sits outside .aac-card as a sibling utility panel -
   this keeps it legible and consistent no matter which of the 12 card
   themes is active, without fighting each theme's own background/blur/
   rotation rules. */
.aac-live-preview {
	display: none;
}

@media (min-width: 900px) {
	.aac-shell {
		display: flex;
		align-items: flex-start;
		justify-content: center;
		gap: 20px;
		max-width: 1220px;
		margin: 0 auto;
	}

	.aac-card {
		margin: 24px 0;
		flex: 0 1 960px;
		min-width: 0;
	}

	.aac-live-preview {
		display: flex;
		flex-direction: column;
		gap: 14px;
		flex: 0 0 220px;
		position: sticky;
		top: 20px;
		align-self: flex-start;
		margin-top: 24px;
		background: #ffffff;
		border: 1px solid #e5e7eb;
		border-radius: 10px;
		box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
		padding: 18px 20px;
	}

	.aac-live-preview-title {
		margin: 0;
		font-size: 11px;
		font-weight: 800;
		text-transform: uppercase;
		letter-spacing: 0.06em;
		color: #9199a6;
		border-bottom: 1px solid #eef0f2;
		padding-bottom: 10px;
	}

	.aac-live-preview-item {
		display: flex;
		flex-direction: column;
		gap: 3px;
	}

	.aac-live-label {
		font-size: 10.5px;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		font-weight: 700;
		color: #6b7280;
	}

	.aac-live-value {
		font-size: 20px;
		font-weight: 800;
		font-variant-numeric: tabular-nums;
		color: #1f2328;
	}

	.aac-live-preview-item.aac-live-net {
		padding-top: 10px;
		border-top: 1px dashed #e5e7eb;
	}

	.aac-live-preview-item.aac-live-net .aac-live-value {
		color: #2563eb;
	}
}

/* Below ~1080px there usually isn't room for the sidebar next to a
   960px-wide card without cramping it - fall back to a compact bar
   docked above the card instead of shrinking the table. */
@media (min-width: 900px) and (max-width: 1079px) {
	.aac-shell {
		flex-direction: column;
		align-items: stretch;
		max-width: 960px;
	}

	.aac-card {
		order: 2;
		margin: 0 auto;
	}

	.aac-live-preview {
		order: 1;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 8px 28px;
		align-items: center;
		width: 100%;
		max-width: 960px;
		margin: 24px auto 18px;
		position: sticky;
		top: 12px;
	}

	.aac-live-preview-title {
		display: none;
	}

	.aac-live-preview-item.aac-live-net {
		padding-top: 0;
		border-top: none;
	}
}

.aac-remove-row {
	background: none;
	border: none;
	color: #b32d2e;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.aac-total-label,
.aac-net-total-label {
	text-align: right;
	font-weight: 700;
}

.aac-net-total-row td {
	background: var(--aac-bg);
	font-size: 15px;
	font-weight: 800;
}

/* ---- Actions / summary / footer ----------------------------------------- */

.aac-actions {
	margin: 14px 0;
}

.aac-summary {
	margin-top: 28px;
}

.aac-summary h3 {
	margin: 0 0 10px;
	font-size: 16px;
}

.aac-footer-notes {
	margin-top: 24px;
	font-size: 13px;
	color: var(--aac-muted);
}

.aac-footer-notes textarea {
	width: 100%;
	border: 1px solid var(--aac-card-border);
	border-radius: 6px;
	padding: 10px;
	font-family: inherit;
	font-size: 13px;
	color: var(--aac-text);
	background: var(--aac-card-bg);
}

.aac-signature-row {
	display: flex;
	justify-content: space-between;
	margin-top: 64px;
	gap: 24px;
}

.aac-signature-block {
	flex: 1;
	text-align: center;
	font-size: 12px;
	color: var(--aac-muted);
}

.aac-signature-line {
	display: block;
	height: 1px;
	background: var(--aac-text);
	margin-bottom: 8px;
}

/* ---- Print & Sheet Options modal ------------------------------------------
   Deliberately theme-independent (fixed colours, not the --aac-* theme
   variables): it renders as a viewport-level overlay outside the themed
   card, so it should read like a normal dialog no matter which of the 12
   card themes is active underneath it, instead of inheriting each theme's
   own (sometimes very heavy) background/border treatment. ------------------ */

.aac-options-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(20, 22, 26, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 10000;
}

.aac-options-modal-backdrop[hidden] {
	display: none;
}

.aac-options-modal {
	background: #ffffff;
	color: #1f2328;
	width: 100%;
	max-width: 560px;
	max-height: 85vh;
	border-radius: 10px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.aac-options-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #e5e7eb;
}

.aac-options-modal-header h3 {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
}

.aac-options-modal-close {
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #6b7280;
	padding: 2px 6px;
}

.aac-options-modal-close:hover {
	color: #1f2328;
}

.aac-options-modal-body {
	padding: 4px 20px 20px;
	overflow-y: auto;
}

.aac-options-group {
	padding: 16px 0;
	border-bottom: 1px solid #f0f1f2;
}

.aac-options-group:last-child {
	border-bottom: none;
	padding-bottom: 4px;
}

.aac-options-group-title {
	margin: 0 0 2px;
	font-weight: 700;
	color: #1f2328;
}

.aac-options-group-hint {
	margin: 0 0 12px;
	font-size: 12px;
	color: #6b7280;
}

.aac-options-modal-footer {
	padding: 14px 20px;
	border-top: 1px solid #e5e7eb;
	display: flex;
	justify-content: flex-end;
}

/* !important here is deliberate: the modal is a theme-independent overlay
   (see the comment above), but every theme's own ".aac-btn" rule further
   down this file is written assuming it's the only thing styling buttons -
   without this, a theme like Brutalism (which sets .aac-btn's background to
   white) would leave this white-text button unreadable on a white button. */
.aac-btn-done {
	background: #1f2328 !important;
	color: #fff !important;
	border: none !important;
	box-shadow: none !important;
}

.aac-sheet-options-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 14px 20px;
}

.aac-options-group .aac-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.aac-options-group .aac-field label:first-child {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #6b7280;
}

.aac-options-group .aac-field input:not([type="radio"]):not([type="checkbox"]),
.aac-options-group .aac-field select {
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13.5px;
	font-family: inherit;
	background: #fff;
	color: #1f2328;
}

.aac-options-group .aac-field input[type="radio"],
.aac-options-group .aac-field input[type="checkbox"] {
	width: 15px;
	height: 15px;
	accent-color: #2563eb;
}

.aac-radio-inline {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
	font-weight: 400;
	text-transform: none;
	letter-spacing: normal;
	margin-right: 12px;
	color: #1f2328;
}

.aac-print-options-checks {
	display: flex;
	align-items: center;
	gap: 6px 18px;
	flex-wrap: wrap;
}

.aac-print-options-checks label {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	cursor: pointer;
	font-size: 13.5px;
}

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

.aac-toolbar {
	margin-top: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.aac-btn {
	padding: 11px 22px;
	border-radius: 7px;
	border: none;
	cursor: pointer;
	font-weight: 700;
	font-size: 14px;
	font-family: inherit;
}

.aac-btn-add-row {
	background: var(--aac-bg);
	color: var(--aac-text);
	border: 1px solid var(--aac-card-border);
}

.aac-btn-save {
	background: var(--aac-accent);
	color: var(--aac-accent-text);
}

.aac-btn-print {
	background: var(--aac-text);
	color: var(--aac-card-bg);
}

.aac-btn-options,
.aac-btn-login,
.aac-btn-open-sheets {
	background: var(--aac-bg);
	color: var(--aac-text);
	border: 1px solid var(--aac-card-border);
}

/* Fixed colours (not the --aac-* theme variables) and !important for the
   same reason as .aac-btn-done above: this sits inside the theme-
   independent modal, but still carries the shared .aac-btn class, so a
   theme's own ".aac-btn { background: ... }" rule further down this file
   would otherwise repaint it (or, worse, leave text unreadable against it -
   see the Brutalism white-on-white bug that rule was added to prevent). */
.aac-btn-open-sheet {
	display: inline-block;
	text-decoration: none;
	text-align: center;
	padding: 6px 16px !important;
	background: #2563eb !important;
	color: #fff !important;
	border: none !important;
	border-radius: 6px !important;
	box-shadow: none !important;
	font-weight: 700;
	font-size: 13px;
}

.aac-sheets-list-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
}

.aac-sheets-list-table th,
.aac-sheets-list-table td {
	border-bottom: 1px solid #eef0f2;
	padding: 8px 6px;
	text-align: left;
}

.aac-sheets-list-table thead th {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #6b7280;
}

.aac-sheets-list-table tbody tr:last-child td {
	border-bottom: none;
}

.aac-save-message {
	font-size: 13px;
}

.aac-save-message.aac-success {
	color: #16794c;
}

.aac-save-message.aac-error {
	color: #b32d2e;
}

/* ==========================================================================
   THEME 1: Minimalism (default)
   ========================================================================== */

.aac-theme-minimalism {
	--aac-bg: #fafafa;
	--aac-card-bg: #ffffff;
	--aac-card-border: #eaeaea;
	--aac-radius: 4px;
	--aac-shadow: none;
	--aac-accent: #111111;
	--aac-title-letter-spacing: 0.08em;
	--aac-title-transform: uppercase;
}

/* ==========================================================================
   THEME 2: Maximalism
   ========================================================================== */

.aac-theme-maximalism {
	--aac-bg: #fff2e5;
	--aac-card-bg: #fffdf7;
	--aac-card-border: #ff5c8a;
	--aac-radius: 18px;
	--aac-shadow: 10px 10px 0 #ffd23f, -6px -6px 0 #6ee7f9;
	--aac-accent: #ff2d78;
	--aac-accent-text: #ffffff;
	--aac-title-transform: uppercase;
}

.aac-theme-maximalism .aac-sheet-title {
	background: linear-gradient(90deg, #ff2d78, #ffb700, #00c2a8);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-size: 28px;
}

.aac-theme-maximalism .aac-btn-print {
	background: #00c2a8;
}

/* ==========================================================================
   THEME 3: Flat Design
   ========================================================================== */

.aac-theme-flat {
	--aac-bg: #ecf0f3;
	--aac-card-bg: #ffffff;
	--aac-card-border: #d6dee6;
	--aac-radius: 6px;
	--aac-shadow: none;
	--aac-accent: #3b82f6;
}

.aac-theme-flat .aac-btn {
	border-radius: 4px;
}

.aac-theme-flat .aac-net-total-row td {
	background: #3b82f6;
	color: #fff;
}

/* ==========================================================================
   THEME 4: Neumorphism
   ========================================================================== */

.aac-theme-neumorphism {
	--aac-bg: #e6e9ef;
	--aac-card-bg: #e6e9ef;
	--aac-card-border: transparent;
	--aac-radius: 24px;
	--aac-shadow: 9px 9px 18px #c4c8cf, -9px -9px 18px #ffffff;
	--aac-accent: #6c7ae0;
}

.aac-theme-neumorphism .aac-field input:not([type="radio"]):not([type="checkbox"]),
.aac-theme-neumorphism .aac-footer-notes textarea {
	border: none;
	box-shadow: inset 3px 3px 6px #c4c8cf, inset -3px -3px 6px #ffffff;
	background: #e6e9ef;
}

.aac-theme-neumorphism .aac-btn {
	box-shadow: 4px 4px 8px #c4c8cf, -4px -4px 8px #ffffff;
	background: #e6e9ef;
	color: var(--aac-text);
}

.aac-theme-neumorphism .aac-btn-save,
.aac-theme-neumorphism .aac-btn-print {
	color: #6c7ae0;
}

/* ==========================================================================
   THEME 5: Claymorphism
   ========================================================================== */

.aac-theme-claymorphism {
	--aac-bg: #eef1ff;
	--aac-card-bg: #f3f1ff;
	--aac-card-border: transparent;
	--aac-radius: 28px;
	--aac-shadow: 0 12px 24px rgba(124, 106, 255, 0.25), inset 0 -6px 12px rgba(255, 255, 255, 0.6), inset 0 6px 12px rgba(124, 106, 255, 0.15);
	--aac-accent: #7c6aff;
}

.aac-theme-claymorphism .aac-field input:not([type="radio"]):not([type="checkbox"]),
.aac-theme-claymorphism .aac-btn,
.aac-theme-claymorphism .aac-footer-notes textarea {
	border-radius: 18px;
	border: none;
	box-shadow: inset 0 -3px 6px rgba(255, 255, 255, 0.6), inset 0 3px 6px rgba(124, 106, 255, 0.2);
	background: #e5e1ff;
}

.aac-theme-claymorphism .aac-btn-save {
	background: #7c6aff;
	box-shadow: 0 6px 14px rgba(124, 106, 255, 0.5);
	color: #fff;
}

.aac-theme-claymorphism .aac-btn-print {
	background: #ff9770;
	box-shadow: 0 6px 14px rgba(255, 151, 112, 0.5);
	color: #fff;
}

/* ==========================================================================
   THEME 6: Aurora UI
   ========================================================================== */

.aac-theme-aurora {
	--aac-card-border: rgba(255, 255, 255, 0.4);
	--aac-radius: 20px;
	--aac-shadow: 0 20px 50px rgba(80, 60, 200, 0.25);
	--aac-accent: #7f5af0;
	--aac-card-bg: rgba(255, 255, 255, 0.85);
	background: linear-gradient(135deg, rgba(127, 90, 240, 0.12), rgba(44, 182, 205, 0.12), rgba(255, 111, 145, 0.12)), var(--aac-card-bg);
	backdrop-filter: blur(6px);
	border: 1px solid var(--aac-card-border);
}

.aac-theme-aurora .aac-sheet-title {
	background: linear-gradient(90deg, #7f5af0, #2cb6cd, #ff6f91);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.aac-theme-aurora .aac-btn-save {
	background: linear-gradient(90deg, #7f5af0, #2cb6cd);
	color: #fff;
}

.aac-theme-aurora .aac-btn-print {
	background: linear-gradient(90deg, #ff6f91, #ffb86b);
	color: #fff;
}

/* ==========================================================================
   THEME 7: Brutalism UI
   ========================================================================== */

.aac-theme-brutalism {
	--aac-bg: #ffffff;
	--aac-card-bg: #ffff00;
	--aac-card-border: #000000;
	--aac-radius: 0;
	--aac-shadow: 8px 8px 0 #000000;
	--aac-text: #000000;
	--aac-accent: #000000;
	--aac-font: "Courier New", Courier, monospace;
	--aac-title-transform: uppercase;
}

.aac-theme-brutalism .aac-card,
.aac-theme-brutalism .aac-field input:not([type="radio"]):not([type="checkbox"]),
.aac-theme-brutalism .aac-footer-notes textarea,
.aac-theme-brutalism .aac-btn {
	border: 3px solid #000 !important;
	border-radius: 0 !important;
}

.aac-theme-brutalism .aac-btn {
	box-shadow: 4px 4px 0 #000;
	background: #fff;
}

.aac-theme-brutalism .aac-btn-save {
	background: #00e0ff;
}

.aac-theme-brutalism .aac-btn-print {
	background: #ff5df0;
}

.aac-theme-brutalism .aac-net-total-row td {
	background: #000;
	color: #ffff00;
}

/* ==========================================================================
   THEME 8: Collage Art
   ========================================================================== */

.aac-theme-collage {
	--aac-bg: #fdf6e3;
	--aac-card-bg: #fffdf8;
	--aac-card-border: #d8c9a3;
	--aac-radius: 2px;
	--aac-shadow: 0 6px 0 rgba(0, 0, 0, 0.05), 3px 10px 18px rgba(0, 0, 0, 0.18);
	--aac-accent: #d64545;
	transform: rotate(-0.3deg);
	background-image: linear-gradient(rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.75)),
		repeating-linear-gradient(45deg, #eee2c2 0, #eee2c2 2px, transparent 2px, transparent 12px);
}

.aac-theme-collage .aac-sheet-title {
	display: inline-block;
	transform: rotate(1deg);
	background: #fff2b2;
	padding: 4px 14px;
	box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

.aac-theme-collage .aac-letterhead {
	transform: rotate(0.6deg);
}

.aac-theme-collage .aac-btn-save {
	background: #d64545;
	color: #fff;
	transform: rotate(-1deg);
}

.aac-theme-collage .aac-btn-print {
	background: #2f6f4e;
	color: #fff;
	transform: rotate(1deg);
}

/* ==========================================================================
   THEME 9: Skeuomorphism
   ========================================================================== */

.aac-theme-skeuomorphism {
	--aac-bg: #d8c8a3;
	--aac-card-bg: #f4ecd8;
	--aac-card-border: #a9895f;
	--aac-radius: 8px;
	--aac-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 20px rgba(60, 40, 10, 0.35);
	--aac-accent: #8a5a2b;
	background-image: linear-gradient(#f7f0dd, #ece0c4);
	border: 1px solid #a9895f;
}

.aac-theme-skeuomorphism .aac-field input:not([type="radio"]):not([type="checkbox"]),
.aac-theme-skeuomorphism .aac-footer-notes textarea {
	background: #fffaf0;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
	border: 1px solid #c8b083;
}

.aac-theme-skeuomorphism .aac-btn {
	background-image: linear-gradient(#c99b57, #8a5a2b);
	color: #fff8ea;
	border: 1px solid #6d4620;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 3px 6px rgba(0, 0, 0, 0.3);
	text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   THEME 10: Retro
   ========================================================================== */

.aac-theme-retro {
	--aac-bg: #f3e4c8;
	--aac-card-bg: #fbf1dd;
	--aac-card-border: #c97b3d;
	--aac-radius: 14px;
	--aac-shadow: 6px 6px 0 #c97b3d;
	--aac-text: #4a2e1e;
	--aac-accent: #c94f3d;
	--aac-font: Georgia, "Times New Roman", serif;
}

.aac-theme-retro .aac-sheet-title {
	color: #c94f3d;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.aac-theme-retro .aac-btn {
	border-radius: 999px;
}

.aac-theme-retro .aac-btn-save {
	background: #4f7d5c;
	color: #fbf1dd;
}

.aac-theme-retro .aac-btn-print {
	background: #c94f3d;
	color: #fbf1dd;
}

.aac-theme-retro .aac-net-total-row td {
	background: #c97b3d;
	color: #fff;
}

/* ==========================================================================
   THEME 11: Glass Morphism
   ========================================================================== */

.aac-theme-glassmorphism {
	--aac-card-border: rgba(255, 255, 255, 0.35);
	--aac-radius: 18px;
	--aac-shadow: 0 8px 32px rgba(31, 38, 135, 0.25);
	--aac-accent: #4f8dfd;
	--aac-text: #1f2328;
	background: rgba(255, 255, 255, 0.55);
	backdrop-filter: blur(14px) saturate(160%);
	-webkit-backdrop-filter: blur(14px) saturate(160%);
	border: 1px solid var(--aac-card-border);
}

body:has(.aac-theme-glassmorphism) {
	background: linear-gradient(135deg, #74ebd5, #acb6e5);
}

.aac-theme-glassmorphism .aac-field input:not([type="radio"]):not([type="checkbox"]),
.aac-theme-glassmorphism .aac-footer-notes textarea {
	background: rgba(255, 255, 255, 0.5);
	border: 1px solid rgba(255, 255, 255, 0.6);
}

.aac-theme-glassmorphism .aac-btn-save,
.aac-theme-glassmorphism .aac-btn-print {
	background: rgba(79, 141, 253, 0.85);
	color: #fff;
}

/* ==========================================================================
   THEME 12: Letterhead (screen preview only - print.css handles the real
   letterhead margin/behaviour). Visually mirrors Minimalism on screen.
   ========================================================================== */

.aac-theme-letterhead {
	--aac-bg: #fafafa;
	--aac-card-bg: #ffffff;
	--aac-card-border: #eaeaea;
	--aac-radius: 4px;
	--aac-shadow: none;
	--aac-accent: #111111;
}

/* ==========================================================================
   Help tooltips
   ========================================================================== */

.aac-help {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 15px;
	height: 15px;
	border-radius: 50%;
	background: var(--aac-muted, #888);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	cursor: help;
	margin-left: 4px;
	position: relative;
	vertical-align: middle;
}

.aac-help:hover::after,
.aac-help.aac-help-active::after {
	content: attr(data-tip);
	position: absolute;
	bottom: 125%;
	left: 50%;
	transform: translateX(-50%);
	background: #1f2328;
	color: #fff;
	padding: 6px 10px;
	border-radius: 6px;
	font-size: 11px;
	font-weight: 400;
	line-height: 1.4;
	white-space: normal;
	width: 200px;
	max-width: 60vw;
	text-align: left;
	z-index: 50;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.aac-help:hover::before,
.aac-help.aac-help-active::before {
	content: '';
	position: absolute;
	bottom: 112%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #1f2328;
}

/* ==========================================================================
   Responsive: tablets and phones
   ========================================================================== */

@media (max-width: 640px) {
	.aac-card {
		margin: 0;
		padding: 16px;
		border-radius: 0;
		max-width: 100%;
	}

	.aac-letterhead {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.aac-sheet-title {
		font-size: 18px;
	}

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

	.aac-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

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

	.aac-actions .aac-btn {
		width: 100%;
	}

	.aac-signature-row {
		flex-direction: column;
		gap: 32px;
		margin-top: 40px;
	}

	/* Stack the rows table into cards instead of horizontal-scrolling. */
	.aac-rows-table,
	.aac-summary-table {
		table-layout: auto;
	}

	.aac-rows-table thead,
	.aac-summary-table thead {
		display: none;
	}

	.aac-rows-table,
	.aac-rows-table tbody,
	.aac-rows-table tr,
	.aac-rows-table td,
	.aac-summary-table,
	.aac-summary-table tbody,
	.aac-summary-table tr,
	.aac-summary-table td {
		display: block;
		width: 100% !important;
	}

	.aac-rows-table tr.aac-row,
	.aac-summary-table tbody tr {
		border: 1px solid var(--aac-card-border);
		border-radius: 8px;
		margin-bottom: 12px;
		padding: 4px;
	}

	.aac-rows-table tr.aac-row td,
	.aac-summary-table tbody tr td {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		border: none;
		padding: 8px 6px;
	}

	.aac-rows-table tr.aac-row td::before,
	.aac-summary-table tbody tr td::before {
		content: attr(data-label);
		font-weight: 700;
		font-size: 11px;
		text-transform: uppercase;
		color: var(--aac-muted);
		flex: 0 0 40%;
	}

	.aac-rows-table tr.aac-row td.aac-col-sn {
		display: none;
	}

	.aac-rows-table tr.aac-row td.aac-desc-cell {
		flex-direction: column;
		align-items: stretch;
	}

	.aac-rows-table tr.aac-row td.aac-desc-cell::before {
		margin-bottom: 4px;
	}

	.aac-rows-table tr.aac-row td.aac-col-action {
		justify-content: flex-end;
	}

	.aac-rows-table tr.aac-row td.aac-col-action::before {
		content: '';
	}

	.aac-rows-table tfoot tr,
	.aac-rows-table tfoot td {
		display: block;
		width: 100% !important;
	}

	.aac-summary-table tfoot tr {
		display: block;
	}

	.aac-summary-table tfoot td {
		display: flex;
		justify-content: space-between;
	}

	.aac-summary-table tfoot td[colspan]::before {
		content: '';
	}
}
