/*
 * Tema da Folha — paleta .theme-payroll (teal profundo).
 * Tokens alinhados ao catálogo de cores do login de folha.
 */
:root,
[data-bs-theme="light"] {
	/* Tokens .theme-payroll */
	--background: #F5F9F8;
	--card: #FFFFFF;
	--foreground: #123330;
	--muted-foreground: #5C7673;
	--primary: #328C7E;
	--primary-deep: #1F534E;
	--primary-glow: #7EEBC8;
	--accent: #DDF3EE;
	--secondary: #EFFFFA;
	--border: #D3E7E4;
	--input: #f3f4f6;
	--destructive: #E2151A;

	--shadow-soft: 0 1px 2px rgb(18 51 48 / 0.06), 0 12px 28px rgb(18 51 48 / 0.08);
	--shadow-elegant: 0 10px 28px rgb(50 140 126 / 0.28), 0 2px 8px rgb(31 83 78 / 0.16);

	/* Bridge MAAP / Bootstrap */
	--project-color-primary: var(--primary);
	--project-color-secondary: var(--primary-deep);
	--project-color-primary-hover: var(--primary-deep);
	--project-color-on-primary: #ffffff;

	--bs-primary: #328C7E;
	--bs-primary-rgb: 50, 140, 126;
	--bs-primary-light: rgba(50, 140, 126, 0.14);
	--bs-primary-clarity: rgba(50, 140, 126, 0.24);
	--bs-primary-inverse: #ffffff;
	--bs-secondary: #1F534E;
	--bs-secondary-rgb: 31, 83, 78;
	--bs-link-color: #1F534E;
	--bs-link-hover-color: #16403c;
	--bs-danger: #E2151A;
	--bs-danger-rgb: 226, 21, 26;
	--bs-body-bg: var(--background);
	--bs-body-color: var(--foreground);
	--bs-border-color: var(--border);
	--maap-shell-bg: var(--background);
	--maap-surface: var(--card);
	--maap-input-bg: #f3f4f6;
	--maap-header-border: var(--border);
}

[data-bs-theme="dark"] {
	/* Superfícies em cinza neutro; o teal fica só na marca (primary/header). */
	--background: #141416;
	--card: #1c1c1f;
	--foreground: #f0f0f2;
	--muted-foreground: #9b9ba3;
	--primary: #328C7E;
	--primary-deep: #7EEBC8;
	--primary-glow: #7EEBC8;
	--accent: #252528;
	--secondary: #19191c;
	--border: #2e2e32;
	--input: #222225;
	--destructive: #E2151A;

	--bs-primary: #328C7E;
	--bs-primary-rgb: 50, 140, 126;
	--bs-primary-light: rgba(50, 140, 126, 0.22);
	--bs-primary-clarity: rgba(50, 140, 126, 0.32);
	--bs-primary-inverse: #ffffff;
	--bs-secondary: #7EEBC8;
	--bs-link-color: #7EEBC8;
	--bs-link-hover-color: #a8f3dc;
	--bs-body-bg: var(--background);
	--bs-body-color: var(--foreground);
	--bs-border-color: var(--border);
	--bs-gray-100: #18181b;
	--bs-gray-200: #2e2e32;
	--bs-gray-300: #3a3a3e;
	--bs-gray-400: #5c5c62;
	--bs-gray-500: #8a8a92;
	--bs-gray-600: #9b9ba3;
	--bs-gray-700: #c8c8ce;
	--bs-gray-800: #e8e8ec;
	--bs-gray-900: #f5f5f6;
	--maap-shell-bg: var(--background);
	--maap-surface: var(--card);
	--maap-surface-muted: #18181b;
	--maap-input-bg: #222225;
	--maap-form-progress-bg: #18181b;
}

/* Botão primary: cor sólida + texto branco. */
.btn-primary {
	--bs-btn-bg: var(--primary);
	--bs-btn-border-color: var(--primary);
	--bs-btn-color: #ffffff;
	--bs-btn-hover-bg: var(--primary-deep);
	--bs-btn-hover-border-color: var(--primary-deep);
	--bs-btn-hover-color: #ffffff;
	--bs-btn-active-bg: var(--primary-deep);
	--bs-btn-active-border-color: var(--primary-deep);
	--bs-btn-active-color: #ffffff;
	background: var(--primary);
	border-color: var(--primary);
	color: #ffffff;
	box-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
	background: var(--primary-deep);
	border-color: var(--primary-deep);
	color: #ffffff;
	filter: none;
}

.btn-outline-primary,
.btn-light.btn-outline-primary {
	border-color: var(--primary);
	color: var(--primary-deep);
	background: var(--card);
}

.text-primary {
	color: var(--primary-deep) !important;
}

.link-primary {
	color: var(--primary-deep) !important;
}

.link-primary:hover,
.link-primary:focus {
	color: var(--primary) !important;
}

/* Header da Folha — barra profunda, labels brancos, marca com fundo suave. */
.folha-header.maap-header,
#kt_header.folha-header.maap-header {
	--folha-header-fg: #ffffff;
	--folha-header-fg-muted: rgba(255, 255, 255, 0.78);
	--folha-header-control: rgba(255, 255, 255, 0.16);
	--folha-header-control-hover: rgba(255, 255, 255, 0.26);
	height: 4.25rem;
	min-height: 4.25rem;
	background: #1F534E;
	border-bottom: 0;
	box-shadow: 0 0.2rem 0.75rem rgb(18 51 48 / 0.18);
}

.folha-header.maap-header .maap-header__inner {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 1rem;
	padding: 0 1rem 0 0.85rem;
}

.folha-header .maap-header__start {
	gap: 0.65rem;
}

.folha-header.maap-header .btn.btn-light,
.folha-header.maap-header .btn.btn-icon.btn-light {
	background: var(--folha-header-control);
	border: 0;
	color: var(--folha-header-fg);
}

.folha-header.maap-header .btn.btn-light:hover,
.folha-header.maap-header .btn.btn-light:focus,
.folha-header.maap-header .btn.btn-light.show,
.folha-header.maap-header .btn.btn-icon.btn-light:hover,
.folha-header.maap-header .btn.btn-icon.btn-light:focus,
.folha-header.maap-header .btn.btn-icon.btn-light.show {
	background: var(--folha-header-control-hover);
	color: var(--folha-header-fg);
}

.folha-header.maap-header .bi {
	color: var(--folha-header-fg);
}

.folha-header__brand {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
}

.folha-header__brand .folha-brand-lockup {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin: 0;
	padding: 0.32rem 0.75rem 0.32rem 0.35rem;
	border: 0;
	border-radius: 0.7rem;
	background: var(--folha-header-control);
	box-shadow: none;
}

.folha-header__brand .folha-brand-mark {
	display: grid;
	place-items: center;
	width: 1.85rem;
	height: 1.85rem;
	flex: 0 0 1.85rem;
	border-radius: 0.42rem;
	background: var(--primary);
	color: #ffffff;
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.02em;
}

.folha-header__brand .folha-brand-copy {
	display: inline-flex;
	align-items: baseline;
	gap: 0.28rem;
	line-height: 1.1;
}

.folha-header__brand .folha-brand-prefix {
	color: var(--folha-header-fg-muted);
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.folha-header__brand .folha-brand-name {
	color: var(--folha-header-fg);
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.folha-header__contexto {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	padding: 0 0.75rem;
	text-align: left;
}

.folha-header__contexto-nome {
	margin: 0;
	color: var(--folha-header-fg);
	font-size: 1.02rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.015em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.folha-header__contexto-cnpj {
	margin: 0.18rem 0 0;
	color: var(--folha-header-fg-muted);
	font-size: 0.78rem;
	font-weight: 500;
	letter-spacing: 0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.folha-header__usuario {
	display: inline-flex !important;
	align-items: center;
	gap: 0.55rem;
	width: auto !important;
	min-width: 0;
	height: auto !important;
	max-width: 16rem;
	padding: 0.32rem 0.35rem 0.32rem 0.7rem !important;
	background: var(--folha-header-control) !important;
	border-radius: 0.7rem !important;
}

.folha-header__usuario:hover,
.folha-header__usuario:focus,
.folha-header__usuario.show {
	background: var(--folha-header-control-hover) !important;
}

.folha-header__usuario-nome {
	max-width: 10rem;
	color: var(--folha-header-fg);
	font-size: 0.9rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.folha-header.maap-header .maap-avatar {
	width: 1.85rem;
	height: 1.85rem;
	border-radius: 0.42rem !important;
	background: rgba(255, 255, 255, 0.92) !important;
	color: var(--primary-deep) !important;
	box-shadow: none;
	font-size: 0.78rem;
}

.folha-header.maap-header .dropdown-menu .maap-avatar {
	width: 2.75rem;
	height: 2.75rem;
	font-size: 0.95rem;
	background: var(--bs-primary-light) !important;
	color: var(--primary-deep) !important;
	box-shadow: none;
}

@media (max-width: 991.98px) {
	.folha-header.maap-header .maap-header__inner {
		grid-template-columns: auto minmax(0, 1fr) auto;
		gap: 0.5rem;
	}

	.folha-header__brand .folha-brand-lockup {
		padding: 0.32rem;
	}

	.folha-header__brand .folha-brand-copy {
		display: none;
	}

	.folha-header__contexto {
		text-align: left;
		padding: 0;
	}

	.folha-header__contexto-nome {
		font-size: 0.85rem;
	}

	.folha-header__contexto-cnpj {
		font-size: 0.7rem;
	}

	.folha-header__usuario-nome {
		display: none;
	}
}
