/* Componentes gerais. Nomes seguem a vault (Padrao_Formulario, Padrao_Tabela,
   Padrao_Barra_de_Filtros, Padrao_Estado_Vazio, Padrao_Modal, Padrao_Toggle_OnOff). */

/* ============================================================
   Botoes
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--raio-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transicao), border var(--transicao), color var(--transicao);
  background: var(--fundo);
  color: var(--texto);
  border-color: var(--borda);
}
.btn:hover { background: var(--branco); border-color: var(--borda-forte); }
.btn:focus-visible { outline: 3px solid var(--cor-primaria-soft); outline-offset: 1px; }

/* Padrao da vault: .btn-primario (em portugues). .btn-primary mantido como alias. */
.btn-primario,
.btn-primary {
  background: var(--cor-primaria);
  color: var(--texto-sobre-primaria);
  border-color: var(--cor-primaria);
  font-weight: 600;
}
.btn-primario:hover,
.btn-primary:hover {
  background: var(--cor-primaria-hover);
  border-color: var(--cor-primaria-hover);
}

.btn-perigo {
  background: var(--erro);
  color: #fff;
  border-color: var(--erro);
  font-weight: 600;
}
.btn-perigo:hover { filter: brightness(0.92); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.btn-icone {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border-radius: var(--raio-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--cor-primaria);
  text-decoration: none;
}
.btn-icone i { font-size: 18px; }
.btn-icone:hover { background: var(--cor-primaria-suave); color: var(--cor-primaria-escura); }
.btn-icone.desabilitado {
  color: var(--texto-fraco);
  cursor: not-allowed;
  opacity: 0.65;
}
.btn-icone.perigo:hover { color: var(--erro); }

.celula-acoes { display: inline-flex; gap: 4px; }

/* ============================================================
   Campos de formulario (Padrao_Formulario)
   ============================================================ */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.campo label {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto);
}
.campo .ajuda { font-size: 12px; color: var(--texto-fraco); }
.campo .erro { font-size: 12px; color: var(--erro); }

.input, .textarea, .select {
  padding: 10px 12px;
  border-radius: var(--raio-sm);
  border: 1px solid var(--borda);
  background: var(--branco);
  color: var(--texto);
  font-size: 14px;
  transition: border var(--transicao), box-shadow var(--transicao);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--cor-primaria);
  box-shadow: 0 0 0 3px var(--cor-primaria-soft);
}
.textarea { min-height: 96px; resize: vertical; }

/* .ra-bar: barra de formulario horizontal (label acima, altura 40px) */
.ra-bar {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.ra-bar .campo { flex-direction: column; gap: 5px; margin-bottom: 0; }
.ra-bar label { font-size: 13px; font-weight: 600; color: var(--texto-secundario); }
.ra-bar .input, .ra-bar .select, .ra-bar > .btn { height: 40px; box-sizing: border-box; padding: 0 12px; }
.ra-bar .input { min-width: 240px; }
.ra-bar .ra-acao { display: flex; flex-direction: column; gap: 5px; }

/* ============================================================
   Barra de filtros (Padrao_Barra_de_Filtros)
   ============================================================ */
.fu-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
  --fu-h: 38px;
}
.fu-bar .g { display: flex; flex-direction: column; gap: 4px; }
.fu-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-secundario);
}
.fu-bar input, .fu-bar select, .fu-bar .btn {
  height: var(--fu-h);
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid var(--borda);
  border-radius: 7px;
  font-size: 13px;
}

/* ============================================================
   Cards, alertas, tela standalone
   ============================================================ */
.card {
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: var(--sp-5);
  box-shadow: var(--sombra);
}

.alerta {
  padding: 10px 14px;
  border-radius: var(--raio-sm);
  font-size: 13px;
  margin-bottom: var(--sp-3);
  border: 1px solid;
}
.alerta.erro { background: #FEF2F2; color: #7F1D1D; border-color: #FCA5A5; }
.alerta.info { background: #EFF6FF; color: #1E3A8A; border-color: #93C5FD; }
.alerta.sucesso { background: #F0FDF4; color: #14532D; border-color: #86EFAC; }

.tela-standalone {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--fundo);
  padding: var(--sp-5);
}
.tela-standalone .quadro { width: 100%; max-width: 380px; }
.tela-standalone .marca-login { text-align: center; margin-bottom: var(--sp-5); }
.tela-standalone .marca-login .logo-quadro {
  width: 56px; height: 56px;
  margin: 0 auto var(--sp-3);
  border-radius: 50%;
  border: 2px solid var(--cor-primaria);
  color: var(--cor-primaria);
  display: grid; place-items: center;
}
.tela-standalone .marca-login .logo-quadro i { font-size: 30px; }
.tela-standalone .marca-login .marca-svg {
  height: 52px;
  width: auto;
  display: block;
  margin: 0 auto var(--sp-3);
}
.tela-standalone .marca-login h1 {
  font-family: var(--font-titulo);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  margin: 0;
}
.tela-standalone .marca-login .subtitulo {
  color: var(--texto-secundario);
  font-size: 13px;
  margin-top: 4px;
}

/* ============================================================
   Tabela (Padrao_Tabela + Padrao_Cabecalho_da_Tabela)
   ============================================================ */
.tabela-wrap {
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  margin-bottom: var(--sp-4);
}
.tabela-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--borda);
}
.tabela-cab h3 {
  font-family: var(--font-titulo);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.tabela-scroll {
  overflow-x: auto;
  border-radius: 0 0 var(--raio) var(--raio);
}
.te-tab {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.te-tab th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-secundario);
  background: var(--fundo);
  border-bottom: 1px solid var(--borda);
  white-space: nowrap;
}
.te-tab td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--borda);
  color: var(--texto);
  vertical-align: middle;
}
.te-tab tbody tr:last-child td { border-bottom: none; }
.te-tab tbody tr:hover { background: var(--fundo); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge.ativo { background: #DCFCE7; color: #14532D; border-color: #86EFAC; }
.badge.inativo { background: #FEF2F2; color: #7F1D1D; border-color: #FCA5A5; }
.badge.pendente { background: #FEF3C7; color: #78350F; border-color: #FCD34D; }

/* Paginacao rodape */
.oc-pag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--borda);
  font-size: 13px;
}
.oc-pag .muted { color: var(--texto-fraco); }
.oc-pag-nav { display: inline-flex; gap: 6px; align-items: center; }
.oc-pag-nav a, .oc-pag-nav span {
  padding: 4px 8px;
  border-radius: var(--raio-sm);
  color: var(--texto-secundario);
}
.oc-pag-nav a:hover { background: var(--fundo); color: var(--texto); }
.oc-pag-nav .atual { color: var(--cor-primaria); font-weight: 600; }

/* ============================================================
   Estado vazio (Padrao_Estado_Vazio)
   ============================================================ */
.vz {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
}
.vz .vz-icone {
  font-size: 40px;
  color: var(--texto-fraco);
  margin-bottom: 16px;
}
.vz-titulo {
  margin: 0;
  font-family: var(--font-titulo);
  font-size: 17px;
  font-weight: 700;
  color: var(--texto);
}
.vz-sub {
  margin: 7px 0 0;
  font-size: 13.5px;
  color: var(--texto-suave);
  max-width: 400px;
}

/* ============================================================
   Modal (Padrao_Modal + Padrao_Modal_Nao_Fecha_Sozinho)
   ============================================================ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-bg.aberto { display: flex; }
.modal-caixa {
  background: var(--branco);
  border-radius: var(--raio-lg);
  box-shadow: var(--sombra-forte);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}
.modal-sm { width: 34vw; }
.modal-md { width: 55vw; }
.modal-lg { width: 89vw; height: 90vh; }
@media (max-width: 880px) {
  .modal-sm, .modal-md, .modal-lg { width: 96vw; height: auto; max-height: 92vh; }
}
.modal-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--borda);
}
.modal-cab h3 {
  font-family: var(--font-titulo);
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.modal-x {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--texto-secundario);
  font-size: 22px;
  line-height: 1;
}
.modal-corpo { padding: 20px; overflow-y: auto; }
.modal-rodape {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--borda);
  background: var(--fundo);
}
.modal-confirm .modal-rodape { justify-content: center; }
.confirm-corpo { text-align: center; padding: 20px 24px 8px; }
.confirm-icone {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 28px;
}
.confirm-aviso { background: #FEF3C7; color: #78350F; }
.confirm-info { background: #EFF6FF; color: #1E3A8A; }
.confirm-perigo { background: #FEF2F2; color: #7F1D1D; }
.confirm-corpo h3 { font-family: var(--font-titulo); font-size: 17px; margin: 0 0 6px; }
.confirm-corpo p { font-size: 14px; color: var(--texto-suave); margin: 0; }

/* ============================================================
   Toggle On/Off (Padrao_Toggle_OnOff)
   ============================================================ */
.cv-sw {
  position: relative;
  width: 42px;
  height: 24px;
  display: inline-block;
  flex: 0 0 auto;
}
.cv-sw input { display: none; }
.cv-sw label {
  position: absolute;
  inset: 0;
  background: var(--borda);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s;
}
.cv-sw label::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.cv-sw input:checked + label { background: #16a34a; }
.cv-sw input:checked + label::after { transform: translateX(18px); }

/* ============================================================
   Loading (Padrao_Loading_Estado)
   ============================================================ */
.spinner-circle {
  width: 44px; height: 44px;
  border: 4px solid var(--borda);
  border-top-color: var(--cor-primaria);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}
@keyframes spinner-rotate { to { transform: rotate(360deg); } }
.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--texto-secundario);
}
.loading-inline .spinner-circle { width: 20px; height: 20px; border-width: 2px; }

/* ============================================================
   Toast de erro (feedback sem popup nativo)
   ============================================================ */
.toast-erro,
.toast-sucesso,
.toast-info,
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  font-size: 14px;
  max-width: 360px;
  transition: opacity .3s ease;
}
.toast-erro    { background: #dc2626; }
.toast-sucesso { background: #16a34a; }
.toast-info    { background: var(--cor-primaria, #6C2C91); }

/* ============================================================
   SelectBusca (substitui <select> nativo)
   ============================================================ */
.sb { position: relative; }
.sb-input { width: 100%; }
.sb-lista {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--borda, #e5e7eb);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  margin-top: 2px;
}
.sb-lista.aberta { display: block; }
.sb-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
.sb-item:hover { background: var(--cor-primaria-suave, #F2E8F8); }
.sb-vazio { color: var(--texto-fraco, #999); cursor: default; }
.sb-limpar { color: var(--texto-fraco, #999); font-style: italic; }

/* ============================================================
   Botao perigo (usado no confirmar modal)
   ============================================================ */
/* ============================================================
   SelectBusca (formato Yazigi: <div class="selectbusca">)
   Usado no admin plataforma (form de escola).
   ============================================================ */
.selectbusca { position: relative; }
.selectbusca .sb-display {
  height: 40px;
  padding: 0 12px;
  background: var(--fundo-elev);
  border: 1px solid var(--borda);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--texto);
}
.selectbusca .sb-display:hover { border-color: var(--cor-primaria); }
.selectbusca .sb-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selectbusca .sb-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: 6px;
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  max-height: 280px;
  overflow-y: auto;
  display: none;
}
.selectbusca.open .sb-panel { display: block; }
.selectbusca .sb-search {
  width: 100%;
  padding: 8px 12px;
  box-sizing: border-box;
  background: var(--fundo-elev);
  border: none;
  border-bottom: 1px solid var(--borda);
  color: var(--texto);
  font-size: 13px;
  outline: none;
}
.selectbusca .sb-opt {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
.selectbusca .sb-opt:hover {
  background: var(--cor-primaria-suave);
  color: var(--cor-primaria-escura);
}

.btn-perigo {
  background: #dc2626;
  color: #fff;
  border: none;
}
.btn-perigo:hover { background: #b91c1c; }
.btn-neutro {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #e5e7eb;
}
.btn-neutro:hover { background: #e5e7eb; }

/* Link secundario nas telas de login (esqueci-senha, voltar). Sistema_de_Estilos. */
.link-secundario {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
}
.link-secundario a {
  color: var(--cor-primaria);
  text-decoration: none;
  font-weight: 500;
}
.link-secundario a:hover {
  color: var(--cor-primaria-escura);
  text-decoration: underline;
}
