/* =============================================================================
   VetNad: Sistema de Gestão Veterinária - Design System (Dark Glassmorphism)
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Cores Base */
  --bg-space: #060913;
  --bg-nebula: radial-gradient(circle at 50% -20%, #151f3c 0%, #060913 70%);
  --bg-card: rgba(15, 22, 42, 0.45);
  --bg-card-hover: rgba(23, 33, 61, 0.6);
  --border-glass: rgba(255, 255, 255, 0.06);
  --border-glass-hover: rgba(99, 102, 241, 0.25);
  
  /* Cores de Ação (Accents) */
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.15);
  --accent-indigo: #6366f1;
  --accent-indigo-glow: rgba(99, 102, 241, 0.25);
  --accent-rose: #ef4444;
  --accent-rose-glow: rgba(239, 68, 68, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.15);
  
  /* Tipografia */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Transições e Sombras */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glow-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Reset Geral */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  scrollbar-width: thin;
  scrollbar-color: var(--border-glass) transparent;
}

body {
  background: var(--bg-nebula);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-indigo);
}

/* =============================================================================
   Layout Principal
   ============================================================================= */

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* Blur Background Orbs */
.nebula-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  opacity: 0.15;
  pointer-events: none;
}
.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-indigo);
  top: -100px;
  right: 10%;
}
.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--accent-emerald);
  bottom: 10%;
  left: 5%;
}

/* =============================================================================
   Sidebar (Menu Lateral)
   ============================================================================= */

.sidebar {
  width: 280px;
  background: rgba(10, 15, 30, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 10;
  height: 100%;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 8px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-emerald));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.brand-icon i {
  color: white;
  font-size: 1.25rem;
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.menu-item button {
  width: 100%;
  background: none;
  border: none;
  padding: 14px 18px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: left;
}

.menu-item button i {
  font-size: 1.15rem;
  transition: var(--transition-smooth);
}

.menu-item button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  transform: translateX(4px);
}

.menu-item.active button {
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.03) 100%);
  border-left: 3px solid var(--accent-indigo);
  padding-left: 15px; /* Compensa a borda */
}

.menu-item.active button i {
  color: var(--accent-indigo);
  text-shadow: 0 0 10px var(--accent-indigo-glow);
}

/* Rodapé do Menu (Status de Conexão) */
.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border-glass);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose-glow);
  transition: var(--transition-smooth);
}

.status-dot.online {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald-glow);
}

.status-dot.connecting {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  animation: pulseStatus 1.2s infinite ease-in-out;
}

@keyframes pulseStatus {
  0% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 0.4; transform: scale(0.9); }
}

/* =============================================================================
   Área de Conteúdo Principal
   ============================================================================= */

.main-content {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 30px;
  height: 100%;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 20px;
}

.header-title h1 {
  font-size: 2rem;
  font-weight: 700;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.75rem;
  color: var(--accent-indigo);
  font-weight: 500;
}

/* =============================================================================
   Elementos Glassmorphism (Cards)
   ============================================================================= */

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
}

/* =============================================================================
   Dashboard: Grid de Métricas
   ============================================================================= */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.metric-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: var(--transition-smooth);
}

.metric-card.clickable {
  cursor: pointer;
  transition: var(--transition-smooth);
}

.metric-card.clickable:hover {
  transform: translateY(-3px);
  border-color: rgba(16, 185, 129, 0.4);
}

.metric-card:hover .metric-icon {
  transform: scale(1.1);
}

.metric-icon.indigo {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-indigo);
}
.metric-icon.emerald {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
}
.metric-icon.amber {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
}

.metric-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* =============================================================================
   Abas / Seções
   ============================================================================= */

.tab-section {
  display: none !important;
  animation: fadeIn 0.4s ease forwards;
}

.tab-section.active {
  display: block !important;
}

.sub-tab-content {
  display: none !important;
}

.sub-tab-content.active {
  display: block !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   Tabelas Estilizadas
   ============================================================================= */

.table-container {
  overflow-x: auto;
  margin-top: 15px;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 14px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-glass);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.9rem;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

/* Badges / Status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
}
.badge.info {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-indigo);
}
.badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
}
.badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-rose);
}

/* =============================================================================
   Formulários Modernos
   ============================================================================= */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  background: rgba(10, 15, 30, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
  background: rgba(10, 15, 30, 0.8);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), #4f46e5);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: var(--accent-rose);
  color: white;
}

.btn-icon-only {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
}

/* =============================================================================
   Módulo: Consulta (Seleção Dinâmica de Produtos e Faturamento)
   ============================================================================= */

.consulta-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
}

@media (max-width: 992px) {
  .consulta-layout {
    grid-template-columns: 1fr;
  }
}

.itens-checkout-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 6px;
}

.checkout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  border: 1px solid var(--border-glass);
}

.checkout-item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkout-item-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.checkout-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.checkout-item-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.checkout-item-price {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

.checkout-total-panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-label {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.total-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-emerald);
  text-shadow: 0 0 10px var(--accent-emerald-glow);
}

/* =============================================================================
   Módulo: Logs de Auditoria
   ============================================================================= */

.log-view-json {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 6px;
  color: #a7f3d0;
  max-width: 250px;
  overflow-x: auto;
  white-space: nowrap;
}

.log-action-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
}
.log-action-badge.INSERT {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}
.log-action-badge.UPDATE {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}
.log-action-badge.DELETE {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-rose);
}
.log-action-badge.LOGIN {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
}

/* =============================================================================
   Módulo: Cadastros (Sub-abas e Grid Layout)
   ============================================================================= */

.sub-tabs-container {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
}

.sub-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.sub-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.sub-tab-btn.active {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--accent-indigo-glow);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.sub-tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.sub-tab-content.active {
  display: block;
}

.cadastro-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 30px;
}

@media (max-width: 992px) {
  .cadastro-layout {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   Módulo: Autenticação (Tela de Login Overlay)
   ============================================================================= */

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 50%, #0c142b 0%, #03050c 100%);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.login-overlay.active {
  display: flex;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  border-radius: 24px;
  border: 1px solid var(--border-glass-hover);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 40px rgba(99, 102, 241, 0.15);
  animation: loginFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   Ajustes de Responsividade & Integração Bootstrap (Glassmorphism Preservado)
   ============================================================================= */

/* Customização para o Sidebar Offcanvas do Bootstrap */
.sidebar.offcanvas-lg {
  background: rgba(6, 9, 19, 0.85) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  border-right: 1px solid var(--border-glass) !important;
  transition: var(--transition-smooth);
}

@media (max-width: 991.98px) {
  .app-container {
    display: block !important;
    width: 100vw !important;
    overflow-x: hidden !important;
  }

  .sidebar.offcanvas-lg {
    width: 280px !important;
    height: 100vh !important;
    padding: 24px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.2) !important;
  }

  .sidebar.offcanvas-lg.show {
    display: flex !important;
  }
  
  .main-content {
    width: 100% !important;
    padding: 20px !important;
    overflow-x: hidden !important;
  }

  .header {
    padding-bottom: 15px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 15px !important;
  }
  
  .user-profile {
    width: 100% !important;
    justify-content: space-between !important;
    padding: 8px 16px !important;
  }
  
  .consulta-layout, .cadastro-layout {
    gap: 20px !important;
  }
}

/* Garante compatibilidade de fontes e formas dos botões */
.btn {
  font-family: 'Outfit', sans-serif !important;
  border-radius: 12px !important;
}

.btn-close-white {
  filter: invert(1) grayscale(1) brightness(2);
}

/* Ajustes de tabelas em telas pequenas */
.table-container {
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: rgba(10, 15, 30, 0.2);
  overflow-x: auto;
}

.dashboard-lower-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
}

/* =============================================================================
   Ajustes Responsivos para Smartphones & Celulares (Samsung S20 / iOS / Android)
   ============================================================================= */
@media (max-width: 991.98px) {
  .dashboard-lower-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  .app-container {
    flex-direction: column !important;
    min-height: 100vh;
  }

  .main-content {
    padding: 12px 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .header {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 15px !important;
    gap: 10px !important;
  }

  .header-title h1 {
    font-size: 1.25rem !important;
  }

  .header-title p {
    font-size: 0.75rem !important;
    display: none;
  }

  .cadastro-layout, .consulta-layout {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .mobile-nav-bar {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    padding: 6px 0 12px 0 !important;
    margin-bottom: 12px !important;
    width: 100% !important;
  }

  .sub-tabs-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 6px 0 12px 0 !important;
    margin-bottom: 12px !important;
    width: 100% !important;
  }

  .mobile-nav-btn {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 4px !important;
    border-radius: 10px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    box-sizing: border-box !important;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    transition: var(--transition-smooth);
  }

  .sub-tab-btn {
    flex: 1 1 auto !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    box-sizing: border-box !important;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    transition: var(--transition-smooth);
  }

  .sub-tab-btn.active, .mobile-nav-btn.active,
  .sub-tab-btn:hover, .mobile-nav-btn:hover {
    background: var(--gradient-primary) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
  }

  .sub-tab-btn.active i, .mobile-nav-btn.active i {
    color: #ffffff !important;
  }

  .menu-item, .menu-item button {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    cursor: pointer !important;
    min-height: 44px !important;
  }

  .glass-card {
    padding: 18px 15px !important;
    border-radius: 16px !important;
  }

  .user-info {
    display: none !important;
  }

  .user-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.85rem !important;
  }
}

/* =============================================================================
   Alternância de Visibilidade da Senha ("Olhinho")
   ============================================================================= */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 42px !important;
}

.btn-toggle-password {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
.btn-close-white {
  filter: invert(1) grayscale(1) brightness(2);
}

/* Ajustes de tabelas em telas pequenas */
.table-container {
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: rgba(10, 15, 30, 0.2);
  overflow-x: auto;
}

.dashboard-lower-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
}

/* =============================================================================
   Ajustes Responsivos para Smartphones & Celulares (Samsung S20 / iOS / Android)
   ============================================================================= */
@media (max-width: 991.98px) {
  .dashboard-lower-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  .app-container {
    flex-direction: column !important;
    min-height: 100vh;
  }

  .main-content {
    padding: 12px 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .header {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 15px !important;
    gap: 10px !important;
  }

  .header-title h1 {
    font-size: 1.25rem !important;
  }

  .header-title p {
    font-size: 0.75rem !important;
    display: none;
  }

  .cadastro-layout, .consulta-layout {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .mobile-nav-bar {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    padding: 6px 0 12px 0 !important;
    margin-bottom: 12px !important;
    width: 100% !important;
  }

  .sub-tabs-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 6px 0 12px 0 !important;
    margin-bottom: 12px !important;
    width: 100% !important;
  }

  .mobile-nav-btn {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 4px !important;
    border-radius: 10px !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    box-sizing: border-box !important;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    transition: var(--transition-smooth);
  }

  .sub-tab-btn {
    flex: 1 1 auto !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    box-sizing: border-box !important;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    transition: var(--transition-smooth);
  }

  .sub-tab-btn.active, .mobile-nav-btn.active,
  .sub-tab-btn:hover, .mobile-nav-btn:hover {
    background: var(--gradient-primary) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
  }

  .sub-tab-btn.active i, .mobile-nav-btn.active i {
    color: #ffffff !important;
  }

  .menu-item, .menu-item button {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    cursor: pointer !important;
    min-height: 44px !important;
  }

  .glass-card {
    padding: 18px 15px !important;
    border-radius: 16px !important;
  }

  .user-info {
    display: none !important;
  }

  .user-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.85rem !important;
  }
}

/* =============================================================================
   Alternância de Visibilidade da Senha ("Olhinho")
   ============================================================================= */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 42px !important;
}

.btn-toggle-password {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  z-index: 5;
}

.btn-toggle-password:hover {
  color: var(--accent-emerald);
}

/* =============================================================================
   Animação de Carregamento e Processamento Global (Ampulheta & Progress Bar)
   ============================================================================= */
.global-loading-overlay,
.global-loading-overlay.active {
  display: none !important;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 48px;
  width: 90%;
  max-width: 400px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  text-align: center;
}

.hourglass-container {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 50%;
  margin-bottom: 18px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.hourglass-icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, #10b981, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hourglassFlip 2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes hourglassFlip {
  0% {
    transform: rotate(0deg) scale(1);
  }
  40% {
    transform: rotate(180deg) scale(1.15);
  }
  50% {
    transform: rotate(180deg) scale(1.15);
  }
  90% {
    transform: rotate(360deg) scale(1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.loading-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: #f1f5f9;
  letter-spacing: 0.3px;
  margin-bottom: 20px;
}

.loading-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.loading-progress-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #6366f1, #3b82f6, #10b981);
  background-size: 300% 100%;
  border-radius: 10px;
  animation: progressBarFlow 2s linear infinite;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

@keyframes progressBarFlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

/* =============================================================================
   Controle de Exibição sem Piscar Tela (Anti-Flicker Absoluto)
   ============================================================================= */
html:not(.logged-in) body .app-container,
body:not(.logged-in) .app-container {
  display: none !important;
}

html.logged-in body .app-container,
body.logged-in .app-container {
  display: flex !important;
}

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #060913 !important;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* Quando não estiver logado ou quando loginOverlay estiver ativo, forçar exibição imediata no Frame 0 */
html.not-logged-in #loginOverlay,
html:not(.logged-in) #loginOverlay,
.login-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
}

/* Quando estiver logado, ocultar imediatamente o overlay */
html.logged-in #loginOverlay:not(.active) {
  opacity: 0 !important;
  visibility: hidden !important;
  display: none !important;
}

/* =============================================================================
   Desativação de Botões em Processamento (Anti-Multi-Clique)
   ============================================================================= */
button:disabled, .btn.disabled, button[disabled] {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
  transform: none !important;
}

/* =============================================================================
   Badges de Origem e Controles do Carrinho da Consulta
   ============================================================================= */
.badge-cart {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 20px;
  line-height: 1.3;
}

.badge-cart-servico {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-cart-insumo-servico {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-cart-avulso {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.cart-qtd-input {
  background: rgba(15, 23, 42, 0.6) !important;
  color: var(--text-primary, #f8fafc) !important;
  border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.1)) !important;
  transition: border-color 0.2s ease;
}

.cart-qtd-input:focus {
  border-color: var(--accent-emerald, #10b981) !important;
  outline: none;
}

