/**
 * Self-contained neutral UI for the Contractor Overhead & Profit Gap Estimator.
 * Colors, type, and spacing are defined here and do not follow the host theme.
 */

#cogap-root {
	--cogap-ink: #1c1917;
	--cogap-muted: #44403c;
	--cogap-line: #d6d3d1;
	--cogap-canvas: #f5f5f4;
	--cogap-surface: #ffffff;
	--cogap-accent: #1f4d3a;
	--cogap-accent-dark: #173c2d;
	--cogap-focus: #0f766e;
	--cogap-warning-bg: #faf6ef;
	--cogap-warning-ink: #78350f;
	--cogap-error: #9f1239;
	--cogap-error-bg: #fff1f2;
	--cogap-strong: #14532d;
	--cogap-strong-bg: #f0fdf4;
	--cogap-moderate: #78350f;
	--cogap-moderate-bg: #fffbeb;
	--cogap-weak: #1e293b;
	--cogap-weak-bg: #f8fafc;
	color-scheme: light;
	box-sizing: border-box;
	width: 100%;
	max-width: min(46rem, 100%);
	margin: 0 auto;
	padding: 2rem 1.5rem 2.75rem;
	background: var(--cogap-canvas);
	color: var(--cogap-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 1.0625rem;
	line-height: 1.6;
	border: 1px solid var(--cogap-line);
	border-radius: 12px;
}

#cogap-root *,
#cogap-root *::before,
#cogap-root *::after {
	box-sizing: border-box;
}

#cogap-root h2,
#cogap-root h3,
#cogap-root p,
#cogap-root ul,
#cogap-root ol,
#cogap-root legend,
#cogap-root label,
#cogap-root button,
#cogap-root input,
#cogap-root select {
	font-family: inherit;
	color: inherit;
}

#cogap-root h2,
#cogap-root h3,
#cogap-root p,
#cogap-root ul,
#cogap-root ol {
	margin: 0 0 0.9rem;
}

#cogap-root h2 {
	font-size: 1.5rem;
	line-height: 1.25;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--cogap-ink);
}

#cogap-root h3 {
	font-size: 1.125rem;
	line-height: 1.35;
	font-weight: 700;
	color: var(--cogap-ink);
}

#cogap-root ul,
#cogap-root ol {
	padding-left: 1.25rem;
}

#cogap-root li + li {
	margin-top: 0.4rem;
}

#cogap-root a {
	color: var(--cogap-accent);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

#cogap-root a:hover {
	color: var(--cogap-accent-dark);
}

#cogap-root :focus-visible {
	outline: 3px solid var(--cogap-focus);
	outline-offset: 2px;
}

#cogap-root [hidden] {
	display: none !important;
}

#cogap-root .cogap-visually-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

#cogap-root .cogap-tool,
#cogap-root .cogap-editorial,
#cogap-root .cogap-faq,
#cogap-root .cogap-intro,
#cogap-root form,
#cogap-root .cogap-step,
#cogap-root .cogap-field,
#cogap-root .cogap-option,
#cogap-root .cogap-options {
	max-width: 100%;
	min-width: 0;
}

#cogap-root .cogap-tool,
#cogap-root .cogap-editorial,
#cogap-root .cogap-faq {
	margin: 0;
}

#cogap-root .cogap-tool {
	padding: 1.35rem 1.25rem 1.5rem;
	background: var(--cogap-surface);
	border: 1px solid var(--cogap-line);
	border-radius: 10px;
}

#cogap-root .cogap-tool > h2 {
	margin-top: 0;
}

#cogap-root .cogap-intro {
	color: var(--cogap-muted);
}

#cogap-root .cogap-step-status {
	margin: 0 0 0.4rem;
	font-weight: 700;
}

#cogap-root .cogap-progress {
	display: block;
	width: 100%;
	height: 0.55rem;
	margin: 0 0 1.25rem;
	appearance: none;
	border: 0;
	border-radius: 999px;
	background: #e7e5e4;
	color: var(--cogap-accent);
}

#cogap-root .cogap-progress::-webkit-progress-bar {
	background: #e7e5e4;
	border-radius: 999px;
}

#cogap-root .cogap-progress::-webkit-progress-value {
	background: var(--cogap-accent);
	border-radius: 999px;
}

#cogap-root .cogap-progress::-moz-progress-bar {
	background: var(--cogap-accent);
	border-radius: 999px;
}

#cogap-root fieldset {
	border: 0;
	margin: 0 0 1.15rem;
	padding: 0;
	min-inline-size: 0;
	max-width: 100%;
}

#cogap-root legend {
	display: block;
	float: none;
	width: 100%;
	max-width: 100%;
	padding: 0;
	margin: 0 0 0.7rem;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--cogap-ink);
	white-space: normal;
	overflow-wrap: anywhere;
}

#cogap-root .cogap-step > legend {
	font-size: 1.35rem;
	letter-spacing: -0.015em;
	margin-bottom: 1rem;
}

#cogap-root .cogap-field {
	margin-bottom: 1.15rem;
}

#cogap-root .cogap-help {
	margin-top: 0;
	color: var(--cogap-muted);
	font-size: 0.98rem;
}

#cogap-root label,
#cogap-root .cogap-field > label {
	display: block;
	margin-bottom: 0.4rem;
	font-weight: 600;
}

#cogap-root input[type="text"],
#cogap-root input[type="number"],
#cogap-root select {
	display: block;
	width: 100%;
	max-width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 0.55rem 0.75rem;
	border: 1px solid #a8a29e;
	border-radius: 8px;
	background: #fff;
	color: var(--cogap-ink);
	font-size: 1rem;
	line-height: 1.4;
	box-shadow: none;
}

#cogap-root select {
	appearance: auto;
}

#cogap-root .cogap-options {
	display: grid;
	gap: 0.5rem;
}

#cogap-root .cogap-options-grid {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

#cogap-root .cogap-option {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	min-height: 44px;
	margin: 0;
	padding: 0.65rem 0.75rem;
	border: 1px solid var(--cogap-line);
	border-radius: 8px;
	background: #fff;
	font-weight: 500;
	cursor: pointer;
}

#cogap-root .cogap-option:has(input:checked),
#cogap-root .cogap-option.is-selected {
	border-color: var(--cogap-accent);
	background: #f3f7f4;
	box-shadow: inset 3px 0 0 var(--cogap-accent);
}

#cogap-root .cogap-option:focus-within {
	outline: 3px solid var(--cogap-focus);
	outline-offset: 2px;
}

#cogap-root .cogap-option input {
	width: 1.15rem;
	height: 1.15rem;
	margin: 0.15rem 0 0;
	flex: 0 0 auto;
	accent-color: var(--cogap-accent);
}

#cogap-root .cogap-option input:focus-visible {
	outline: none;
}

#cogap-root .cogap-option span {
	display: block;
	padding-top: 0.05rem;
}

#cogap-root .cogap-error,
#cogap-root .cogap-warning,
#cogap-root .cogap-hint {
	margin: 0.4rem 0 0;
	font-size: 0.98rem;
}

#cogap-root .cogap-error {
	color: var(--cogap-error);
	font-weight: 600;
}

#cogap-root .cogap-warning {
	padding: 0.55rem 0.7rem;
	border: 1px solid #ead7a4;
	border-radius: 8px;
	background: var(--cogap-warning-bg);
	color: var(--cogap-warning-ink);
}

#cogap-root .cogap-hint:empty {
	display: none;
}

#cogap-root .cogap-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 0.5rem;
}

#cogap-root .cogap-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	min-width: 44px;
	margin: 0;
	padding: 0.65rem 1.15rem;
	border-radius: 8px;
	border: 1px solid transparent;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	box-shadow: none;
}

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

#cogap-root .cogap-btn-primary:hover {
	background: var(--cogap-accent-dark);
	border-color: var(--cogap-accent-dark);
	color: #fff;
}

#cogap-root .cogap-btn-secondary {
	background: #fff;
	border-color: #a8a29e;
	color: var(--cogap-ink);
}

#cogap-root .cogap-btn-secondary:hover {
	background: #f5f5f4;
	color: var(--cogap-ink);
}

#cogap-root .cogap-btn:disabled {
	background: #e7e5e4;
	border-color: #e7e5e4;
	color: #44403c;
	cursor: not-allowed;
}

#cogap-root .cogap-results:empty {
	margin: 0;
	padding: 0;
	border: 0;
}

#cogap-root .cogap-results {
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--cogap-line);
}

#cogap-root .cogap-results h2 {
	margin-top: 0;
	font-variant-numeric: tabular-nums;
}

#cogap-root .cogap-figure-pct,
#cogap-root .cogap-may-not,
#cogap-root .cogap-echo {
	margin-bottom: 0.75rem;
}

#cogap-root .cogap-may-not {
	font-weight: 700;
}

#cogap-root .cogap-signal {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.75rem 1rem;
	margin: 0 0 1.15rem;
	padding: 0.9rem 1rem;
	border: 1px solid var(--cogap-line);
	border-radius: 10px;
	background: #fafaf9;
}

#cogap-root .cogap-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0;
	padding: 0.35rem 0.7rem;
	border: 2px solid currentColor;
	border-radius: 999px;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
}

#cogap-root .cogap-badge-icon {
	width: 1.15rem;
	height: 1.15rem;
	flex: 0 0 auto;
}

#cogap-root .cogap-badge-strong {
	color: var(--cogap-strong);
	background: var(--cogap-strong-bg);
}

#cogap-root .cogap-badge-moderate {
	color: var(--cogap-moderate);
	background: var(--cogap-moderate-bg);
}

#cogap-root .cogap-badge-weak {
	color: var(--cogap-weak);
	background: var(--cogap-weak-bg);
}

#cogap-root .cogap-signal-meaning {
	flex: 1 1 16rem;
	margin: 0;
}

#cogap-root .cogap-status p,
#cogap-root .cogap-holdback p,
#cogap-root .cogap-example {
	margin-bottom: 0.7rem;
}

#cogap-root .cogap-rule {
	color: var(--cogap-muted);
}

#cogap-root table {
	width: 100%;
	margin: 0 0 1.15rem;
	border-collapse: collapse;
	font-size: 1rem;
	font-variant-numeric: tabular-nums;
	table-layout: fixed;
}

#cogap-root caption {
	caption-side: top;
	margin: 0 0 0.45rem;
	text-align: left;
	font-weight: 700;
	color: var(--cogap-ink);
}

#cogap-root th,
#cogap-root td {
	padding: 0.55rem 0.45rem;
	border-bottom: 1px solid var(--cogap-line);
	text-align: left;
	vertical-align: top;
	font-weight: 500;
	overflow-wrap: anywhere;
}

#cogap-root thead th {
	font-weight: 700;
	background: #f5f5f4;
}

#cogap-root tbody th,
#cogap-root tfoot th {
	font-weight: 700;
	width: 58%;
}

#cogap-root tfoot th,
#cogap-root tfoot td {
	border-top: 2px solid var(--cogap-ink);
	border-bottom: 0;
}

#cogap-root .cogap-is-current th,
#cogap-root .cogap-is-current td {
	font-weight: 700;
	box-shadow: inset 3px 0 0 var(--cogap-accent);
	background: #f3f7f4;
}

#cogap-root .cogap-disclaimer {
	margin: 1rem 0 0;
	font-size: 1.0625rem;
	line-height: 1.6;
	font-weight: 400;
	color: var(--cogap-ink);
}

#cogap-root .cogap-editorial,
#cogap-root .cogap-faq {
	margin-top: 2.25rem;
}

#cogap-root .cogap-editorial h2,
#cogap-root .cogap-faq > h2 {
	margin-top: 0;
	margin-bottom: 0.85rem;
}

#cogap-root .cogap-faq-item {
	margin: 0 0 1.15rem;
	padding-bottom: 0.25rem;
}

#cogap-root .cogap-faq-item h3 {
	margin-bottom: 0.4rem;
}

#cogap-root .cogap-term {
	position: relative;
	display: inline-block;
}

#cogap-root .cogap-tip-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	min-width: 44px;
	margin: 0;
	padding: 0 0.15rem;
	border: 0;
	background: transparent;
	color: var(--cogap-accent);
	font: inherit;
	font-weight: 700;
	line-height: inherit;
	text-align: left;
	text-decoration: underline dotted;
	text-underline-offset: 0.18em;
	cursor: help;
	box-shadow: none;
}

#cogap-root .cogap-tip-trigger:hover {
	color: var(--cogap-accent-dark);
}

#cogap-root .cogap-tip {
	display: none;
	position: absolute;
	z-index: 20;
	left: 0;
	top: calc(100% + 0.25rem);
	width: min(18rem, calc(100vw - 2.5rem));
	max-width: min(18rem, calc(100vw - 2.5rem));
	padding: 0.65rem 0.75rem;
	border-radius: 8px;
	background: #1c1917;
	color: #fff;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.45;
	text-align: left;
	white-space: normal;
	box-shadow: 0 8px 24px rgba(28, 25, 23, 0.18);
}

#cogap-root .cogap-term:hover .cogap-tip,
#cogap-root .cogap-term:focus-within .cogap-tip,
#cogap-root .cogap-term.is-open .cogap-tip {
	display: block;
}

#cogap-root .cogap-term.is-dismissed .cogap-tip,
#cogap-root .cogap-term.is-dismissed:hover .cogap-tip,
#cogap-root .cogap-term.is-dismissed:focus-within .cogap-tip,
#cogap-root .cogap-term.is-dismissed.is-open .cogap-tip {
	display: none;
}

@media (max-width: 40rem) {
	#cogap-root {
		margin: 0;
		padding: 1.15rem 0.75rem 1.75rem;
		border-left: 0;
		border-right: 0;
		border-radius: 0;
	}

	#cogap-root .cogap-tool {
		padding: 1rem 0.75rem 1.15rem;
	}

	#cogap-root h2 {
		font-size: 1.3rem;
	}

	#cogap-root .cogap-nav,
	#cogap-root .cogap-results-actions {
		flex-direction: column;
	}

	#cogap-root .cogap-btn {
		width: 100%;
	}
}
