/* Base compartilhada: reset, tipografia, controles, botões, avisos. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #c4bcdc transparent; }
body {
  margin: 0;
  font-family: var(--fonte);
  font-size: var(--t-md);
  font-weight: 450;
  line-height: 1.55;
  color: var(--texto);
  background: var(--fundo);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-feature-settings: 'lnum' 1;
}
::selection { background: var(--lavanda-2); color: var(--navy); }
:focus-visible { outline: 3px solid var(--ciano); outline-offset: 2px; border-radius: 6px; }
a { color: var(--roxo-texto); text-underline-offset: 0.2em; }
a:hover { color: var(--navy); }
h1, h2, h3 { color: var(--navy); margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: var(--t-md); font-weight: 700; }
p { margin: 0; text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Topo */
.topo { background: var(--navy); color: #fff; }
.topo__barra { max-width: 1160px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.marca { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; }
.marca strong { font-size: var(--t-lg); font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; }
.marca span { font-size: var(--t-xs); font-weight: 600; color: #c9bde6; white-space: nowrap; }
.marca i { width: 1px; height: 20px; background: #5a5590; }
.topo__usuario { display: flex; align-items: center; gap: 12px; font-size: var(--t-sm); color: #d8d2ee; min-width: 0; }
.topo__usuario b { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topo .btn--fantasma { color: #fff; border-color: #5a5590; }
.topo .btn--fantasma:hover { background: var(--navy-2); border-color: #8a84c4; }

/* Botões */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1.5px solid transparent;
  font-weight: 650; font-size: var(--t-sm); line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms var(--ease);
}
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn svg { flex: none; }
.btn--primario { background: var(--navy); color: #fff; }
.btn--primario:hover:not([disabled]) { background: var(--navy-2); }
.btn--secundario { background: var(--superficie); color: var(--navy); border-color: var(--borda); }
.btn--secundario:hover:not([disabled]) { border-color: var(--navy); }
.btn--fantasma { background: transparent; color: var(--navy); border-color: var(--borda); min-height: 36px; padding: 0 12px; }
.btn--texto { background: none; color: var(--roxo-texto); padding: 0 8px; min-height: 36px; }
.btn--texto:hover:not([disabled]) { color: var(--navy); text-decoration: underline; }
.btn--pequeno { min-height: 34px; padding: 0 12px; font-size: var(--t-xs); border-radius: 8px; }
.btn.is-ok { color: var(--ok); border-color: var(--ok); }

/* Campos */
.campo { display: grid; gap: 6px; }
.campo label, .rotulo { font-weight: 650; font-size: var(--t-md); color: var(--navy); }
.ajuda { font-size: var(--t-sm); color: var(--texto-3); }
input[type='text'], input[type='email'], input[type='search'], textarea, select {
  width: 100%;
  background: var(--superficie);
  border: 1.5px solid var(--borda);
  border-radius: var(--raio-sm);
  padding: 11px 13px;
  font-weight: 500;
  color: var(--texto);
  caret-color: var(--roxo);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234b338f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input::placeholder, textarea::placeholder { color: #75738a; font-weight: 450; }
input:hover, textarea:hover, select:hover { border-color: #b9b0d6; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--roxo); box-shadow: 0 0 0 4px rgba(75, 51, 143, 0.14); }
.campo.is-erro input, .campo.is-erro textarea, .campo.is-erro select { border-color: var(--erro); }
.erro-msg { font-size: var(--t-sm); font-weight: 600; color: var(--erro); }
.contador { justify-self: end; font-size: var(--t-xs); color: var(--texto-3); font-variant-numeric: tabular-nums; }

/* Avisos */
.aviso { padding: 12px 14px; border-radius: var(--raio-sm); font-size: var(--t-sm); font-weight: 550; }
.aviso--ok { background: var(--ok-fundo); color: var(--ok); }
.aviso--erro { background: var(--erro-fundo); color: var(--erro); }
.aviso--atencao { background: var(--aviso-fundo); color: var(--aviso); }
.aviso--info { background: var(--lavanda); color: var(--navy); }

.cartao { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: var(--t-sm); font-weight: 600; box-shadow: 0 10px 30px -10px rgba(29, 26, 85, 0.6);
  transition: opacity 180ms ease, transform 200ms var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.carregando { display: flex; align-items: center; gap: 10px; color: var(--texto-2); font-weight: 600; padding: 48px 0; }
.giro { animation: girar 900ms linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

dialog {
  border: 0; padding: 0; border-radius: 14px; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 24px 60px -20px rgba(29, 26, 85, 0.5); color: var(--texto);
}
dialog::backdrop { background: rgba(29, 26, 85, 0.45); }
.dialogo { padding: 24px; display: grid; gap: 16px; }
.dialogo__acoes { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.rodape { margin-top: auto; border-top: 1px solid var(--linha); background: var(--superficie); font-size: var(--t-xs); color: var(--texto-3); }
.rodape div { max-width: 1160px; margin: 0 auto; padding: 14px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
main[tabindex="-1"]:focus { outline: none; }
