/* SIPI — estilo base do núcleo. Módulos podem reutilizar estas classes.
   Paleta institucional do SIPI (a mesma do SIPI original no Joomla, pacote v1.2.1). */

/* Fonte da marca: Outfit (SIL Open Font License 1.1, ver fontes/OFL-Outfit.txt), embutida para funcionar sem internet */
@font-face {
	font-family: "Outfit";
	src: url("fontes/Outfit.woff2") format("woff2");
	font-weight: 100 900;
	font-display: swap;
}

:root {
	--fundo: #f0f4fb;
	--superficie: #ffffff;
	--superficie-2: #fbfcfe;
	--borda: #dde5f1;
	--texto: #22324a;
	--texto-suave: #5d6f8a;
	--primaria: #2a69b8;
	--primaria-escura: #1e4f8f;
	--primaria-texto: #ffffff;
	--acento: #132f53;
	--ciano: #6fbfdb;
	--marinho: #001b4c;
	--degrade: linear-gradient(135deg, #2a69b8 0%, #1e4f8f 55%, #132f53 100%);
	--fonte-marca: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--lateral: #0a1f45;
	--lateral-texto: #c6d5ea;
	--lateral-ativo: #163463;
	--ok-fundo: #ecfdf5; --ok-texto: #065f46; --ok-borda: #a7f3d0;
	--erro-fundo: #fef2f2; --erro-texto: #991b1b; --erro-borda: #fecaca;
	--info-fundo: #eff6ff; --info-texto: #1e40af; --info-borda: #bfdbfe;
	--perigo: #dc2626;
	--raio: 10px;
	--sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--fundo: #07132b;
		--superficie: #0e1d3a;
		--superficie-2: #0a1730;
		--borda: #1c2e52;
		--texto: #e3eaf5;
		--texto-suave: #98a9c4;
		--primaria: #4a8ad8;
		--primaria-escura: #2a69b8;
		--acento: #6fbfdb;
		--lateral: #001133;
		--lateral-ativo: #163463;
		--ok-fundo: #052e1f; --ok-texto: #6ee7b7; --ok-borda: #065f46;
		--erro-fundo: #2a0f12; --erro-texto: #fca5a5; --erro-borda: #7f1d1d;
		--info-fundo: #0c1a3a; --info-texto: #93c5fd; --info-borda: #1e3a8a;
		--perigo: #ef4444;
		--sombra: none;
		color-scheme: dark;
	}
}

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

body {
	margin: 0;
	background: var(--fundo);
	color: var(--texto);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--primaria); }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
h1, h2, h3 { line-height: 1.25; }

/* ------------------------------------------------------------ estrutura */

.sipi { display: flex; min-height: 100vh; }

.lateral {
	width: 240px;
	flex-shrink: 0;
	background:
		radial-gradient(420px 260px at 0% 0%, rgba(59, 128, 212, .25), transparent 70%),
		linear-gradient(180deg, #0a1f45 0%, #001b4c 100%);
	color: var(--lateral-texto);
	border-right: 1px solid rgba(255, 255, 255, .04);
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
}

.marca {
	display: flex;
	align-items: center;
	gap: .7rem;
	padding: 1.2rem 1.25rem 1rem;
	color: #fff;
	text-decoration: none;
	font-weight: 800;
	font-size: 1.15rem;
	letter-spacing: .02em;
}
.logo-sipi { display: block; flex-shrink: 0; filter: drop-shadow(0 6px 14px rgba(0, 12, 34, .45)); }
.marca-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--fonte-marca); font-weight: 700; letter-spacing: .04em; }

.menu { display: flex; flex-direction: column; padding: .25rem .75rem; gap: 2px; }
.menu a {
	color: var(--lateral-texto);
	text-decoration: none;
	padding: .5rem .75rem;
	border-radius: 8px;
}
.menu a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.menu a.ativo { background: var(--degrade); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(42, 105, 184, .35); }
.menu-titulo {
	margin: 1rem .75rem .25rem;
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #64748b;
}
.lateral-rodape { margin-top: auto; padding: 1rem 1.25rem; font-size: .75rem; color: #475569; }

.principal {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	background: radial-gradient(900px 320px at 100% 0%, rgba(42, 105, 184, .08), transparent 70%);
}

.topo {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: .75rem 1.5rem;
	background: color-mix(in srgb, var(--superficie) 85%, transparent);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--borda);
	position: sticky;
	top: 0;
	z-index: 5;
}
.topo h1 { margin: 0; font-size: 1.15rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topo-usuario { display: flex; align-items: center; gap: .75rem; }
.topo-usuario a { color: var(--texto); text-decoration: none; font-weight: 500; }
.topo-config { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem; border-radius: 8px; }
.topo-config:hover { background: var(--superficie-2); color: var(--primaria) !important; }
.topo-config svg { color: var(--primaria); }
.topo-usuario form { margin: 0; }
.botao-menu { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--texto); cursor: pointer; padding: 0 .25rem; }
.fundo-menu { display: none; }

.conteudo { padding: 1.5rem; width: 100%; max-width: 1200px; }

/* ------------------------------------------------------------ componentes */

.cartao {
	background: var(--superficie);
	border: 1px solid var(--borda);
	border-radius: var(--raio);
	box-shadow: var(--sombra);
	padding: 1.25rem 1.5rem;
	margin-bottom: 1.25rem;
}
.cartao-titulo { margin: 0 0 1rem; font-size: 1.1rem; }
.secao-titulo { margin: 1.5rem 0 .5rem; font-size: 1rem; }
.texto-suave { color: var(--texto-suave); }

.aviso {
	padding: .75rem 1rem;
	border-radius: 8px;
	border: 1px solid;
	margin-bottom: 1rem;
}
.aviso-ok   { background: var(--ok-fundo);   color: var(--ok-texto);   border-color: var(--ok-borda); }
.aviso-erro { background: var(--erro-fundo); color: var(--erro-texto); border-color: var(--erro-borda); }
.aviso-info { background: var(--info-fundo); color: var(--info-texto); border-color: var(--info-borda); }

.botao {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4rem;
	padding: .5rem .95rem;
	border-radius: 8px;
	border: 1px solid var(--borda);
	background: var(--superficie);
	color: var(--texto);
	font: inherit;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}
.botao:hover { background: var(--superficie-2); }
.botao:disabled { opacity: .55; cursor: not-allowed; }
.botao-primario { background: var(--primaria); border-color: var(--primaria); color: var(--primaria-texto); }
.botao-primario:hover { background: var(--primaria-escura); }
.botao-perigo { color: var(--perigo); border-color: var(--perigo); }
.botao-discreto { border-color: transparent; color: var(--texto-suave); padding: .35rem .6rem; }
.botao-largo { width: 100%; margin-top: .5rem; }

.formulario { display: flex; flex-direction: column; gap: .9rem; }
.formulario-estreito { max-width: 420px; }
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
input[type=search], input[type=datetime-local], input[type=time], input[type=url], input[type=tel], select, textarea {
	font: inherit;
	padding: .55rem .7rem;
	border-radius: 8px;
	border: 1px solid var(--borda);
	background: var(--superficie-2);
	color: var(--texto);
	width: 100%;
}
input:focus, select:focus, textarea:focus, .botao:focus-visible {
	outline: 2px solid var(--ciano);
	outline-offset: 1px;
}
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.coluna-inteira { grid-column: 1 / -1; }

.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--borda); vertical-align: top; }
.tabela th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); }
.tabela .acoes { text-align: right; }
/* A célula continua table-cell (com flex ela sai da grade da tabela); os botões ficam lado a lado dentro dela */
.tabela td.acoes { white-space: normal; }
.tabela td.acoes > * { display: inline-block; vertical-align: middle; margin: .15rem 0 .15rem .4rem; }
.tabela td.acoes form { margin-top: .15rem; margin-bottom: .15rem; }

.etiqueta { display: inline-block; white-space: nowrap; padding: .15rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 600; }
.etiqueta-ok { background: var(--ok-fundo); color: var(--ok-texto); }
.etiqueta-inativa { background: var(--superficie-2); color: var(--texto-suave); border: 1px solid var(--borda); }

.envio { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.envio input[type=file] { flex: 1; min-width: 220px; }
.alerta-confianca { margin: 1rem 0 0; font-size: .85rem; color: var(--texto-suave); }

.desinstalar summary { list-style: none; }
.desinstalar summary::-webkit-details-marker { display: none; }
.desinstalar[open] form {
	margin-top: .5rem;
	padding: .75rem;
	border: 1px solid var(--erro-borda);
	background: var(--erro-fundo);
	border-radius: 8px;
	text-align: left;
	display: flex;
	flex-direction: column;
	gap: .6rem;
	max-width: 300px;
}
.opcao { display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; }
.formulario label.opcao { flex-direction: row; font-weight: 400; } /* caixa de seleção ao lado do texto */

.dados { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; margin: 0; }
.dados dt { color: var(--texto-suave); }
.dados dd { margin: 0; }

.boas-vindas {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.4rem 1.6rem;
	margin-bottom: 1.25rem;
	border-radius: 14px;
	color: #fff;
	background:
		radial-gradient(500px 200px at 100% 0%, rgba(255, 255, 255, .18), transparent 60%),
		var(--degrade);
	box-shadow: 0 12px 30px rgba(19, 47, 83, .3);
	overflow: hidden;
}
.boas-vindas p { margin: 0; }
.boas-vindas-titulo { font-size: 1.25rem; }
.boas-vindas-data { opacity: .85; margin-top: .2rem !important; font-size: .92rem; }
.boas-vindas-logo { flex-shrink: 0; filter: drop-shadow(0 8px 20px rgba(0, 12, 34, .4)); }
.vazio { text-align: center; padding: 3rem 1rem; }
.vazio-logo { display: block; margin: 0 auto 1rem; }
.vazio h2 { margin: .5rem 0; font-size: 1.2rem; }
.vazio p { color: var(--texto-suave); margin: 0 0 1.25rem; }
.vazio-icone { font-size: 2.5rem; font-weight: 700; color: var(--texto-suave); }

.grade-cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.cartao-modulo { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; color: inherit; margin: 0; }
.cartao-modulo:hover { border-color: var(--primaria); }
.cartao-modulo-nome { font-weight: 600; font-size: 1.05rem; }

/* ------------------------------------------------------------ páginas simples (login, instalação) */

.pagina-simples {
	display: grid;
	place-items: center;
	min-height: 100vh;
	padding: 2.5rem 1rem;
	background:
		radial-gradient(800px 520px at 15% -5%, rgba(59, 128, 212, .42), transparent 60%),
		radial-gradient(700px 520px at 105% 105%, rgba(30, 79, 143, .5), transparent 60%),
		linear-gradient(160deg, #04122e 0%, #0a2350 55%, #04122e 100%);
	background-attachment: fixed;
}
/* grade sutil sobre o fundo, mais forte no centro */
.pagina-simples::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	background-image:
		linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
	background-size: 44px 44px;
	-webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
	mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}
.caixa { position: relative; width: 100%; max-width: 410px; }
.caixa-larga { max-width: 660px; }
.marca-centro {
	flex-direction: column;
	gap: .55rem;
	padding: 0;
	margin-bottom: 1.5rem;
	text-align: center;
}
.marca-centro .logo-sipi { filter: drop-shadow(0 12px 28px rgba(0, 12, 34, .55)); }
.marca-significado { font: 600 .8rem/1.35 var(--fonte-marca); letter-spacing: .16em; text-transform: uppercase; color: #cfe3f7; }
.pagina-simples .cartao {
	border: 1px solid rgba(255, 255, 255, .08);
	border-radius: 16px;
	padding: 1.75rem;
	box-shadow: 0 24px 60px rgba(2, 6, 23, .55);
}
.pagina-simples .cartao-titulo { font-size: 1.3rem; margin-bottom: .25rem; }
.cartao-subtitulo { margin: 0 0 1.25rem; }
.pagina-simples .botao-primario { background: var(--degrade); border: 0; padding: .7rem 1rem; }
.pagina-simples .botao-primario:hover { filter: brightness(1.08); }
.rodape-simples { margin: 1.25rem 0 0; text-align: center; font-size: .8rem; color: rgba(207, 227, 247, .55); }
/* Instituição (brasão + nome) no rodapé do login, como no SIPI original */
.instituicao { margin-top: 1.6rem; display: grid; justify-items: center; gap: .5rem; color: #b9cbe3; font-size: .82rem; letter-spacing: .03em; text-align: center; }
.instituicao img { display: block; height: 64px; width: auto; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .35)); }
.instituicao + .rodape-simples { margin-top: .6rem; }
.requisitos { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.requisitos li { display: flex; gap: .6rem; align-items: baseline; }
.requisitos .selo { font-weight: 700; width: 1rem; }
.requisitos .ok .selo { color: var(--ok-texto); }
.requisitos .falha .selo, .requisitos .falha { color: var(--erro-texto); }
.comando {
	background: var(--superficie-2);
	border: 1px solid var(--borda);
	border-radius: 8px;
	padding: .6rem .8rem;
	margin: 0;
	overflow-x: auto;
	font: .9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ------------------------------------------------------------ celular */

@media (max-width: 860px) {
	.lateral {
		position: fixed;
		left: 0;
		z-index: 20;
		transform: translateX(-100%);
		transition: transform .2s ease;
	}
	.lateral.aberto { transform: none; }
	.lateral.aberto + .fundo-menu { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 15; }
	.botao-menu { display: block; }
	.topo { padding: .75rem 1rem; }
	.conteudo { padding: 1rem; }
	.cartao { padding: 1rem; }
	.grade-2 { grid-template-columns: 1fr; }
	.tabela td.acoes { text-align: left; }
	.tabela td.acoes > * { margin: .15rem .4rem .15rem 0; }
}

/* Troca de senha obrigatória: botão "Sair sem trocar" logo abaixo do formulário */
.sair-discreto { margin-top: .5rem; }

/* ------------------------------------------------------------ configurações */

.trilha { margin: 0 0 1rem; font-size: .9rem; color: var(--texto-suave); }
.trilha a { text-decoration: none; font-weight: 500; }
.trilha a:hover { text-decoration: underline; }
.config-opcoes .cartao-modulo { gap: .45rem; padding: 1.4rem 1.5rem; }
.config-icone { color: var(--primaria); }

.empresa { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 1.75rem; align-items: start; }
.empresa-previa {
	display: grid;
	justify-items: center;
	align-content: center;
	gap: .6rem;
	min-height: 220px;
	padding: 1.25rem 1rem;
	border-radius: 12px;
	text-align: center;
	color: #b9cbe3;
	background:
		radial-gradient(260px 180px at 15% 0%, rgba(59, 128, 212, .42), transparent 70%),
		linear-gradient(160deg, #04122e 0%, #0a2350 55%, #04122e 100%);
}
.empresa-previa img { display: block; max-width: 100%; height: 72px; width: auto; object-fit: contain; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .35)); }
.empresa-previa-rotulo { font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.empresa-previa-nome { font-size: .85rem; letter-spacing: .03em; }
.empresa-sem-logo { font-size: .85rem; opacity: .75; font-style: italic; }
.empresa-dica { margin: -.4rem 0 0; font-size: .85rem; }
.empresa-previa .logo-sipi { margin: .25rem 0; }
.empresa-previa .marca-significado { min-height: 1.1em; text-align: center; }
.empresa-previa-separador { width: 48px; border-top: 1px solid rgba(207, 227, 247, .25); margin: .35rem 0; }
.identidade-grupo { border: 1px solid var(--borda); border-radius: 8px; padding: .75rem 1rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
.identidade-grupo legend { padding: 0 .4rem; font-weight: 600; }
@media (max-width: 760px) { .empresa { grid-template-columns: 1fr; } }

/* Configurações › Integrações */
.token-criado { border-color: var(--ok-borda); background: var(--ok-fundo); }
.token-valor { display: flex; gap: .5rem; flex-wrap: wrap; }
.token-valor input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.integ-base { margin: 1rem 0 0; font-size: .85rem; }
.integ-data { white-space: nowrap; }
.integ-revogado td { opacity: .6; }
.integ-revogado td.acoes { opacity: 1; }
.integ-formulario { max-width: 720px; }
.integ-saidas { border: 1px solid var(--borda); border-radius: 8px; padding: .75rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.integ-saidas legend { padding: 0 .4rem; font-weight: 600; }
.integ-saidas .opcao { font-weight: 400; }
/* Com "Todas as saídas" marcado, as saídas avulsas ficam sem efeito */
.integ-saidas:has(input[name=todas]:checked) .integ-saida { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------ blocos do site (BlocosSite) */
[hidden] { display: none !important; }
.bloco-moldura { border: 1px solid var(--borda); border-radius: var(--raio); overflow: hidden; background: #fff; margin-bottom: 1.2rem; }
.bloco-moldura-rotulo { display: block; padding: .45rem .8rem; font-size: .78rem; color: var(--texto-suave); background: var(--superficie-2); border-bottom: 1px solid var(--borda); }
.bloco-situacao { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.bloco-caixa { border: 1px solid var(--borda); border-radius: var(--raio); padding: .9rem 1rem 1rem; display: grid; gap: .9rem; }
.bloco-caixa legend { font-weight: 600; padding: 0 .35rem; }
.bloco-cor { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; }
.bloco-cor > label:first-child { display: flex; align-items: center; gap: .6rem; }
.bloco-cor input[type=color] { width: 3.2rem; height: 2.2rem; padding: .15rem; border: 1px solid var(--borda); border-radius: 8px; background: var(--superficie); cursor: pointer; }
.bloco-cor input[type=color]:disabled { opacity: .35; cursor: not-allowed; }
.bloco-contraste { font-size: .85rem; }
.bloco-contraste-baixo { color: var(--perigo); font-weight: 600; }
.bloco-figura { display: grid; gap: .6rem; }
.bloco-figura p { margin: 0; }
.bloco-itens { display: grid; gap: .6rem; }
.bloco-item { display: grid; grid-template-columns: minmax(9rem, 12rem) 1fr minmax(8rem, 1fr); gap: .5rem; align-items: end; }
.bloco-item label { font-size: .85rem; }
@media (max-width: 760px) { .bloco-item { grid-template-columns: 1fr; padding-bottom: .6rem; border-bottom: 1px dashed var(--borda); } }
