/* DGRU - Modern Design System (MASTER STANDARD) */
:root {
  /* Cores Core */
  --primary: #5B92E5;
  --primary-glow: rgba(91, 146, 229, 0.3);
  --bg-dark: rgba(20, 20, 20, 0.4);
  --border-color: rgba(91, 146, 229, 0.5);
  --error: #ff4d4d;
  --success: #00ff88;

  /* Glassmorphism & Visual */
  --glass-blur: blur(20px);
  --shadow-main: 0 15px 35px rgba(0,0,0,0.5);
  --shadow-float: 0 25px 60px rgba(0,0,0,0.6);
  --transition-fast: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --mask-effect: linear-gradient(to bottom, transparent 0%, black 20px, black calc(100% - 25px), transparent 100%);

  /* Tipografia Scale */
  --font-size-title: 22px;
  --font-size-subtitle: 18px;
  --font-size-body: 14px;
  --font-size-label: 12px;

  /* Arredondamento */
  --radius-lg: 20px;
  --radius-md: 15px;
  --radius-sm: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Open Sans", sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 0 10px;
}

/* Trava de Rolagem Global ao abrir janelas */
body.modal-open {
  overflow: hidden !important;
}

body::before {
  content: "";
  position: fixed;
  top: -5%;
  left: -5%;
  width: 110vw;
  height: 110vh;
  background: url("imagem/Background.gif") no-repeat center center #000;
  background-size: cover;
  z-index: -1;
}

.wrapper {
  width: 400px;
  border-radius: var(--radius-sm);
  padding: 30px;
  text-align: center;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

form {
  display: flex;
  flex-direction: column;
}

h2 {
  font-size: 2rem;
  margin-bottom: 25px;
  color: #5B92E5;
}

.wrapper h2 {
  text-align: center;
}

.home-panel h2, .modal-content h2 {
  text-align: left;
}

.input-field {
  position: relative;
  border-bottom: 2px solid #5B92E5;
  margin: 15px 0;
}

.input-field label {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-40%); /* Ajuste para centralizar melhor com o padding */
  color: #5B92E5;
  font-size: 16px;
  pointer-events: none;
  transition: 0.15s ease;
}

.input-field input {
  width: 100%;
  height: 40px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: #fff;
  padding-right: 35px;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  cursor: pointer;
  color: #5B92E5;
  transition: filter 0.3s ease;
}

.toggle-password:hover {
  filter: brightness(1.2);
}

.input-field.error, .select-field.error select {
  border-color: var(--error) !important;
  animation: shakeError 0.4s ease-in-out;
}

.input-field.error label,
.input-field.error input,
.select-field.error label {
  color: var(--error) !important;
}

@keyframes shakeError {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}

.input-field input:focus~label,
.input-field input:valid~label,
.input-field input.has-value~label,
.input-field input[readonly]~label,
.input-field textarea:focus~label,
.input-field textarea.has-value~label {
  font-size: 0.8rem;
  top: 10px;
  transform: translateY(-110%);
}

.input-field textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: #fff;
  font-family: inherit;
  resize: vertical;
  padding-top: 10px;
  min-height: 40px;
}

.forget {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 15px 0 25px 0;
  color: #5B92E5;
}

.wrapper a {
  color: #5B92E5;
  text-decoration: none;
}

.wrapper a:hover {
  text-decoration: underline;
}

button {
  background: #5B92E5;
  color: #111;
  font-weight: 600;
  border: 2px solid #5B92E5;
  padding: 12px 24px;
  cursor: pointer;
  border-radius: 8px; /* Standard rounded corners */
  font-size: 16px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

button:hover {
  background: rgba(91, 146, 229, 0.15);
  color: #5B92E5;
}

.loader {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(91, 146, 229, 0.2);
  border-radius: 50%;
  border-top-color: #5B92E5;
  animation: spinLoader 0.8s linear infinite;
  display: inline-block;
  box-sizing: border-box;
}

/* Loader Compacto para Botões */
button .loader {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  margin: 0;
}

.loader-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 40px 0;
  grid-column: 1 / -1;
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

/* Unified Hover State moved up to main button */

.register {
  text-align: center;
  margin-top: 30px;
  color: #fff;
}

.whatsapp-float {
  position: fixed;
  width: 60px;
  height: 60px;
  bottom: 60px;
  right: 40px;
  background-color: #5B92E5;
  color: #111;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
  transition: transform 0.3s ease, opacity 0.5s ease;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  color: #111;
}

.logo {
  position: fixed;
  max-height: 80px;
  width: auto;
  z-index: 100;
  pointer-events: none; /* Previne bugar cliques durante fadeout */
  opacity: 0;
}

.logo-dgru {
  top: 30px;
  left: 30px;
}

.logo-dgru:hover {
  transform: scale(1.05);
}

.logo-ufrn {
  top: 30px;
  right: 30px;
}

.logo-ufrn:hover {
  transform: scale(1.05);
}

.logo-qd {
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
}

.logo-qd:hover {
  transform: translateX(-50%) scale(1.05);
}

.footer-container {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  will-change: opacity, transform;
}

.footer-text {
  color: #fff;
  font-size: clamp(8px, 2.8vw, 14px);
  white-space: nowrap;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.footer-text a {
  color: #5B92E5;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
  filter: brightness(1.2);
}

.footer-text a:hover {
  text-decoration: underline;
  color: #5B92E5;
  filter: brightness(1.5);
}

.notification-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  width: 320px;
  padding: 15px 20px;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.4); /* Glassmorphism Padrão DGRU */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(91, 146, 229, 0.5);
  color: #fff;
  text-align: left;
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: slideInToast 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.toast .toast-message {
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  margin-bottom: 4px;
}

.toast .progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background-color: #5B92E5;
  width: 100%;
  transform-origin: left;
}

@keyframes slideInToast {
  0% { transform: translateX(-120%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutToast {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-120%); opacity: 0; }
}

@keyframes progressShrink {
  0% { width: 100%; }
  100% { width: 0%; }
}

/* Regra Dinâmica para Telas Menores (Celulares) */
@media (max-width: 600px) {
  .notification-container {
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    align-items: center;
  }
  
  .toast {
    width: 100%;
    max-width: 320px;
    /* Altera o deslize nativo para subir ou descer em celulares */
    animation: slideInToastMobile 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  }

  /* Em celulares a animação deve vir de baixo ao invés da esquerda para ficar harmonioso pelo centro */
  @keyframes slideInToastMobile {
    0% { transform: translateY(120%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
  }
}

/* PAINEL HOME (PÓS-LOGIN) */
.hidden-panel {
  display: none !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.95);
}

.home-panel {
  width: 95%;
  max-width: 1000px;
  height: auto; /* Altura flexível baseada no conteúdo */
  min-height: 300px; /* Mas nunca fica espremido demais */
  max-height: 85vh; /* E não passa de 85% da tela (Scroll ativará internamente) */
  margin: auto;
  border-radius: var(--radius-lg);
  padding: 30px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  color: #fff;
  will-change: transform, opacity, width, height;
  overflow: hidden; 
}

/* Ajuste Fino para Celulares: Estabilização de Altura Dinâmica com Bordas */
@media (max-width: 768px) {
  .home-panel {
    width: 96%;
    height: auto; /* Flexível também no celular */
    max-height: 90dvh; /* Usa só o limite máximo se necessário */
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-color); 
    padding: 20px 15px;
    margin: auto; /* Mantém espaço respiratório na tela */
  }
}

/* Transição do Login (Wrapper) */
#loginWrapper {
  opacity: 0;
}

.home-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 20px;
  margin-bottom: 40px;
  gap: 20px;
}

.nav-top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
}

.nav-center-logo {
  display: flex;
  justify-content: center;
}

.nav-logo {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
}

.nav-logo .logo-light {
  color: #fff;
  font-weight: 300;
}

.nav-logo .logo-bold {
  color: #5B92E5;
  font-weight: 700;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 30px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(91, 146, 229, 0.4) transparent;
  width: 100%;
  max-width: 100%;
}

/* Truque Avançado: Pseudo-elementos com margin auto 
   Se os itens couberem na tela, as margens os centralizam perfeitamente.
   Se tiver muitos itens (precisar de scroll), as margens somem e eles 
   encostam na esquerda nativamente, sem travar o scroll! */
.nav-links::before,
.nav-links::after {
  content: "";
  margin: auto;
}
.nav-links::-webkit-scrollbar { height: 4px; }
.nav-links::-webkit-scrollbar-track { background: transparent; }
.nav-links::-webkit-scrollbar-thumb { background: rgba(91, 146, 229, 0.4); border-radius: 4px; }

.nav-links a {
  text-decoration: none;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  font-size: 16px;
  transition: color 0.3s;
  padding-bottom: 5px;
  cursor: pointer;
}

.nav-links a:hover, .nav-links a.active {
  color: #5B92E5;
  border-bottom: 2px solid #5B92E5;
}

.nav-profile {
  display: flex;
  justify-content: flex-end;
}

.nav-profile span {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}

.view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
}
.view-container::-webkit-scrollbar { width: 5px; }
.view-container::-webkit-scrollbar-track { background: transparent; }
.view-container::-webkit-scrollbar-thumb { background: rgba(91, 146, 229, 0.4); border-radius: 10px; }

.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  max-width: 100%;
  padding: 20px 0 40px 0; /* Espaço para não cortar botões */
}

.home-content h1 {
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
}

.home-content h1 span {
  color: #5B92E5;
}

.home-content p {
  font-size: 18px;
  color: rgba(255,255,255,0.8);
  margin-bottom: 40px;
  line-height: 1.6;
}

.btn-outline {
  background: rgba(91, 146, 229, 0.2); /* Fundo sutil em vez de borda */
  color: #fff;
  border: none;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: 0.3s;
}

.btn-outline:hover {
  background: #5B92E5;
  color: #111;
}

.btn-edit-data {
  margin-top: 20px;
  padding: 10px 24px;
  font-size: 14px;
}

.btn-add-user {
  padding: 10px 18px;
  font-size: 14px;
}
.btn-minimal-ghost {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0 10px;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  color: #5B92E5;
}
.btn-minimal-ghost svg {
  stroke: currentColor;
  stroke-width: 2.5px;
}
.btn-minimal-ghost:hover {
  transform: scale(1.2) rotate(15deg);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.btn-minimal-ghost:focus {
  outline: none;
  background: transparent !important;
}

@media (max-width: 768px) {
  .home-panel {
    padding: 20px;
    height: auto;
    min-height: 80vh;
  }
  .nav-top-row {
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
  }
  .nav-logo {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    font-size: 16px;
    line-height: 1.1;
  }
  .nav-center-logo img {
    height: 35px !important;
  }
  .nav-profile span {
    font-size: 12px;
    white-space: normal;
    text-align: right;
  }
}

/* SISTEMA SPA / GRID CARDS DE CREDENCIAIS */
.view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0; /* Essencial: Impede o container de crescer infinitamente, permitindo o scroll nas listas filhas */
  overflow: hidden;
}
.hidden-view {
  display: none !important;
}

.cred-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 15px;
  margin-bottom: 20px;
}
.cred-header h2 { font-size: 24px; color: #5B92E5; margin: 0; line-height: 1.2; }

.data-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1; /* Ocupa todo o espaço restante do painel fixo */
  padding: 5px 10px 20px 0;
  overflow-y: auto; /* Scroll interno independente */
  
  /* Melhora o toque visual com o gradiente */
  mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
}

/* Otimização PC: Usar as laterais vazias com Grid de 2 Colunas */
@media (min-width: 900px) {
  .data-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    align-items: stretch; /* Garante que os cards na mesma linha tenham a mesma altura */
    mask-image: none;
    -webkit-mask-image: none;
  }
  
  /* Credenciais só precisam de uma coluna horizontal */
  #usersListContainer {
    grid-template-columns: 1fr;
  }
}
.data-list::-webkit-scrollbar { width: 6px; }
.data-list::-webkit-scrollbar-thumb { background: rgba(91, 146, 229, 0.4); border-radius: 10px; }

.data-card {
  background: rgba(20, 20, 20, 0.4);
  border: 1px solid rgba(91, 146, 229, 0.3);
  border-radius: 10px;
  padding: 15px;
  cursor: pointer;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
}
.data-card:hover { border-color: #5B92E5; background: rgba(20, 20, 20, 0.6); }

.data-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.data-header h3 { font-size: 18px; margin: 0; color: #fff; }

.data-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(91, 146, 229, 0.15);
  border-radius: 12px;
  color: #5B92E5;
  border: 1px solid rgba(91, 146, 229, 0.4);
  display: inline-block;
  line-height: normal;
}

.data-details {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: default;
  flex: 1; /* Preenche o espaço vazio e empurra rodapé para baixo */
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detail-item { display: flex; flex-direction: column; font-size: 14px; }
.detail-item strong { color: rgba(255,255,255,0.6); font-size: 12px; }


/* MODAL / EDIÇÃO FLUTUANTE */
/* CELEBRAÇÃO DE ANIVERSÁRIO */
#celebrationOverlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent; /* Removido para ver o GIF */
  overflow: hidden;
}
#celebrationOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.55)), url("Parabens.gif") center/cover no-repeat;
  filter: blur(0.5px);
  z-index: 1; /* Traz para frente do fundo transparente */
}
.celebration-card {
  background: rgba(14, 14, 14, 0.5);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 35px;
  padding: 40px 25px;
  width: 90%;
  max-width: 580px;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,0.9);
  position: relative;
  z-index: 10; /* Garante que o cartão fique acima do GIF do overlay */
}
.btn-celebration-close {
  position: fixed;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.7));
}
.btn-celebration-close svg {
  display: block;
  flex-shrink: 0;
  stroke: #ffffff !important;
}
#bTitle {
  font-size: clamp(24px, 6vw, 46px);
  font-weight: 800;
  margin-bottom: 25px;
  background: linear-gradient(90deg, #42c2f1, #fbda4f, #ab63df, #5fc581, #42c2f1);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
  animation: shineTitle 4s linear infinite;
}
#bContent {
  color: rgba(255, 255, 255, 0.95);
  font-size: clamp(14px, 3vw, 18px);
  line-height: 1.6;
}

@keyframes shineTitle {
  to { background-position: 200% center; }
}
#mainSVG {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 8500;
  overflow: visible;
  visibility: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  animation: fadeInOverlay 0.4s forwards;
  overflow-y: auto;
  padding: 20px 0;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-dark);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 35px 30px;
  width: 95%;
  max-width: 700px;
  color: #fff;
  margin: auto;
  box-shadow: var(--shadow-float);
  
  /* Sistema de Encaixe Inteligente */
  display: flex;
  flex-direction: column;
  max-height: 94vh;
  overflow: hidden;
}

/* Todos os formulários dentro de modais seguem o padrão elástico */
.modal-content form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 15px;
}
.modal-title-bar h2 { 
  color: #5B92E5; 
  margin: 0; 
  font-size: 20px; 
  line-height: 40px; /* Igualamos a altura da linha à altura dos botões (40px) */
  vertical-align: middle;
}
.modal-top-actions {
  display: flex;
  align-items: center; /* Alinha os centros dos botões */
  justify-content: flex-end;
  gap: 15px;
  height: 40px; /* Mesma altura dos botões e do line-height do H2 */
}
.btn-delete {
  background: rgba(255, 77, 77, 0.1);
  color: #ff4d4d;
  border: 1px solid #ff4d4d;
}
.btn-delete:hover {
  background: #ff4d4d;
  color: #111;
}

.btn-edit {
  background: #5B92E5;
  color: #111;
  border: 1px solid #5B92E5;
}
.btn-edit:hover {
  background: transparent;
  color: #5B92E5;
}
.btn-icon-top {
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
.btn-icon-top svg {
  stroke: #fff; /* Garantia de visibilidade total */
  stroke-width: 2.5; /* Traço levemente mais grosso para UX */
}
.btn-icon-top:hover {
  background: rgba(91, 146, 229, 0.2);
}
.btn-icon-top:hover svg {
  stroke: #5B92E5; /* Brilho azul no hover */
}
.btn-icon-top.locked {
  color: #ff4d4d;
}
.btn-delete-red:hover, .btn-close-red:hover {
  background: rgba(255, 77, 77, 0.2) !important;
  color: #ff4d4d !important;
}

/* User Card Responsive Flex Adjustments */
.flex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  width: 100%;
  flex-wrap: nowrap;
}
.user-info-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  flex: 1;
}
.user-main-name { margin: 0; min-width: 100px; word-break: break-all; }
.btn-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.3s;
}
.user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}


.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px; 
  flex: 1; /* Ocupa todo o espaço elástico do formulário */
  overflow-y: auto;
  padding: 15px 15px; /* Ajuste para dar ar aos títulos */
  margin-top: 0px; /* Ajustado para 0px conforme pedido */
  margin-bottom: 25px; /* Respiro obrigatório antes do botão de ação */
  
  /* Ajuste preciso: "Subindo" o efeito (5px) e deixando nítido em cima, com desvaneio na base (25px) */
  mask-image: linear-gradient(to bottom, transparent 0%, black 5px, black calc(100% - 25px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5px, black calc(100% - 25px), transparent 100%);
}

.modal-grid::-webkit-scrollbar { 
  width: 8px; /* Trazendo barra de rolagem visual reativada */
  display: block;
}
.modal-grid::-webkit-scrollbar-thumb { 
  background: rgba(91, 146, 229, 0.6); 
  border-radius: 10px; 
}

.modal-field { margin: 0 !important; } /* Deixamos o grid controlar o gap */
/* --- STANDARDIZED SELECT COMPONENT --- */
.select-field { 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
  margin: 0; 
  position: relative;
  width: 100%;
}

.select-field label { 
  font-size: 13px; 
  color: #5B92E5; 
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.select-field select { 
  width: 100%;
  background: rgba(255, 255, 255, 0.05); 
  color: #fff; 
  border: 1px solid rgba(91, 146, 229, 0.3); 
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  appearance: none; /* Remove default arrow to style our own */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B92E5' stroke-width='3' 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 15px center;
  background-size: 14px;
}

.select-field select:focus {
  border-color: #5B92E5;
  background-color: rgba(91, 146, 229, 0.1);
  box-shadow: 0 0 0 2px rgba(91, 146, 229, 0.2);
}

.select-field select option {
  background: #111;
  color: #fff;
}

.escala-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255,255,255,0.03);
  padding: 10px;
  border-radius: 8px;
  border-left: 2px solid #5B92E5;
}
.escala-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  width: 100%;
}
.escala-row strong { color: #5B92E5; width: 60px; font-weight: 600; font-size: 14px; }
.escala-row label {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
  min-width: 65px;
  gap: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(91, 146, 229, 0.3);
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.3s ease;
  color: #fff;
  font-weight: 400;
}
.escala-row label:hover { 
  background: rgba(91, 146, 229, 0.15); 
  border-color: #5B92E5;
  transform: translateY(-1px);
}
.escala-row input[type="checkbox"] { accent-color: #5B92E5; cursor: pointer; }

.modal-actions {
  display: flex;
  justify-content: flex-end; /* Alinhado ao fim conforme o snippet HTML */
  margin-top: 1px; /* Ajustado para 1px conforme pedido para um design mais compacto */
}
.btn-close-x {
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: none;
  font-size: 20px;
  cursor: pointer;
  transition: color 0.3s;
}
.btn-close-x:hover {
  color: #ff4d4d;
}

@media (max-width: 768px) {
  .details-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-top-actions { gap: 8px; }
  .btn-icon-top { width: 34px; height: 34px; }
  .modal-title-bar h2 { font-size: 16px; }
  
  /* GRID DE ESCALA RESPONSIVO */
  .escala-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
    gap: 8px;
    padding-bottom: 15px;
  }
  .escala-row strong {
    grid-column: 1 / -1;
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 5px;
    margin-bottom: 5px;
  }
  .escala-row label {
    justify-content: center;
    padding: 10px 5px; /* Botões maiores para dedo no mobile */
    font-size: 12px;
    background: rgba(91, 146, 229, 0.08); /* Brilho sutil no mobile */
  }
}

@keyframes shineTitle {
  to { background-position: 200% center; }
}