/* ----------------------------------------------------
   DESIGN SYSTEM & ESTILOS GLOBAIS - NOT'IN SISTEMAS
------------------------------------------------------- */

:root {
  /* Paleta de Cores HSL Tailored (Claro, Branco e Verde) */
  --bg-base: #f1f5f9;       /* Slate 100 */
  --bg-surface: #ffffff;    /* Branco */
  --bg-surface-elevated: #ffffff;
  --login-background: radial-gradient(circle at 10% 20%, #e2e8f0 0%, #f8fafc 90.1%);
  --surface-hover: rgba(15, 23, 42, 0.05);
  --surface-subtle: rgba(15, 23, 42, 0.03);
  --table-row-hover: rgba(15, 23, 42, 0.02);
  
  --primary-gradient: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  --primary-color: #16a34a;
  --primary-hover: #15803d;
  --primary-glow: rgba(22, 163, 74, 0.4);
  
  --success-color: hsl(158, 64%, 52%);
  --success-glow: rgba(16, 185, 129, 0.3);
  
  --danger-color: hsl(343, 81%, 59%);
  --danger-glow: rgba(239, 68, 68, 0.3);
  
  --warning-color: hsl(38, 92%, 50%);
  --warning-glow: rgba(245, 158, 11, 0.3);
  
  --text-primary: #1e293b;   /* Slate 800 */
  --text-secondary: #64748b; /* Slate 500 */
  --text-muted: #94a3b8;     /* Slate 400 */
  --border-color: rgba(0, 0, 0, 0.1);
  --border-focus: rgba(22, 163, 74, 0.5);
  
  /* Efeito Glassmorphic (Claro) */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.05);
  --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  --glass-blur: blur(12px);

  /* Fontes */
  --font-header: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Bordas e Sombras */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Movimento: curto, funcional e sem alterar a identidade visual */
  --motion-fast: 150ms;
  --motion-base: 220ms;
  --motion-slow: 320ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: var(--motion-fast) var(--ease-standard);
  --transition-normal: var(--motion-base) var(--ease-standard);
  --transition-slow: var(--motion-slow) var(--ease-emphasized);
}

/* Modo claro obrigatório. */
html[data-theme="light"] {
  color-scheme: light;
}

/*
Modo escuro preservado, mas desativado por decisão do produto.
html[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #0f172a !important;
  --bg-surface: #1e293b !important;
  --bg-surface-elevated: #334155 !important;
  --text-primary: #f8fafc !important;
  --text-secondary: #94a3b8 !important;
  --text-muted: #64748b !important;
  --border-color: rgba(255, 255, 255, 0.08) !important;
  --border-focus: rgba(99, 102, 241, 0.5) !important;
  --glass-bg: rgba(30, 41, 59, 0.65) !important;
  --glass-border: rgba(255, 255, 255, 0.05) !important;
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37) !important;
  --login-background: radial-gradient(circle at 10% 20%, #0f172a 0%, #1e293b 90.1%) !important;
  --surface-hover: rgba(255, 255, 255, 0.05) !important;
  --surface-subtle: rgba(255, 255, 255, 0.03) !important;
  --table-row-hover: rgba(255, 255, 255, 0.01) !important;
}
*/

/* Os controles permanecem no código, mas ficam ocultos enquanto o tema escuro estiver desativado. */
.theme-toggle-btn {
  display: none !important;
}

/*
html[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #0f172a !important;
  --bg-surface: #1e293b !important;
  --bg-surface-elevated: #334155 !important;
  --text-primary: #f8fafc !important;
  --text-secondary: #94a3b8 !important;
  --text-muted: #64748b !important;
  --border-color: rgba(255, 255, 255, 0.08) !important;
  --border-focus: rgba(99, 102, 241, 0.5) !important;
  --glass-bg: rgba(30, 41, 59, 0.65) !important;
  --glass-border: rgba(255, 255, 255, 0.05) !important;
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37) !important;
  --login-background: radial-gradient(circle at 10% 20%, #0f172a 0%, #1e293b 90.1%) !important;
  --surface-hover: rgba(255, 255, 255, 0.05) !important;
  --surface-subtle: rgba(255, 255, 255, 0.03) !important;
  --table-row-hover: rgba(255, 255, 255, 0.01) !important;
}
*/

/* Reset Geral */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body, #app, .main-frame {
  max-width: 100vw;
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

:where(a, button, input, select, textarea, [role="button"]):focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border: 2px solid var(--bg-base);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* --- LOADER INICIAL --- */
.initial-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1.5rem;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 15px var(--primary-glow);
}
.initial-loader p {
  color: var(--text-secondary);
  font-family: var(--font-header);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  animation: pulse 1.5s infinite ease-in-out;
}

.initial-loader-logo {
  color: var(--primary-color);
  font-size: 4rem;
  animation: float 4s ease-in-out infinite;
}

.initial-loader-cache-btn {
  margin-top: 0.5rem;
  background: var(--bg-surface);
  border-style: dashed;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.fatal-error-screen {
  min-height: 100vh;
  height: auto;
  padding: 2rem;
  text-align: center;
  background: var(--bg-base);
  color: var(--text-primary);
}

.fatal-error-icon {
  color: var(--danger-color);
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.fatal-error-screen h2 {
  color: var(--danger-color);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.fatal-error-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 550px;
  margin-bottom: 1.5rem;
}

.fatal-error-details {
  width: min(100%, 650px);
  padding: 1rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  text-align: left;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
}

.fatal-error-details strong {
  display: block;
  color: var(--danger-color);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.fatal-error-details code,
.fatal-error-details pre {
  color: var(--text-primary);
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.fatal-error-details code {
  font-size: 0.8rem;
}

.fatal-error-details pre {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* --- LAYOUT DA APLICAÇÃO --- */
.app-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Hamburguer Menu Toggle no Mobile */
.sidebar-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.5rem;
  margin-right: 0.75rem;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.sidebar-toggle-btn:hover {
  background: var(--surface-hover);
}

@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 80px 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar-toggle-btn {
    display: inline-flex;
  }
  
  .app-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed !important;
    top: 0;
    left: -280px; /* Esconde a sidebar fora da tela */
    width: 280px;
    height: 100vh;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000 !important;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    overflow: hidden;
  }
  
  .sidebar.open {
    left: 0 !important; /* Desliza para dentro */
  }
  
  /* Backdrop de fundo no mobile */
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    z-index: 999 !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto !important;
  }
  
  .top-header {
    padding: 1rem !important;
  }
  
  .header-controls {
    gap: 0.5rem !important;
  }
  
  .company-selector-wrapper {
    padding: 0.4rem 0.6rem !important;
  }
  
  .network-status-badge {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.75rem !important;
  }
  
  .net-simulator-btn {
    padding: 0.4rem 0.6rem !important;
  }
  
  .net-simulator-btn span {
    display: none; /* Oculta texto para caber o ícone */
  }
}

/* Sidebar */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 1rem;
  z-index: 10;
}

.sidebar-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sidebar-main nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 1.5rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  background: var(--primary-gradient);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.logo-icon i {
  font-size: 1.25rem;
  color: #fff;
}

.logo-text {
  font-family: var(--font-header);
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.menu-list {
  list-style: none;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.menu-item a:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.menu-item.active a {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.menu-item a i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.app-version {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-align: center;
  letter-spacing: 0.02em;
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger-color);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  transform: translateY(-1px);
}

.sidebar-logout-btn i {
  width: 20px;
  text-align: center;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .logo-text,
  .menu-item a span,
  .sidebar-logout-btn span {
    display: none;
  }

  .logo-section,
  .menu-item a,
  .sidebar-logout-btn {
    justify-content: center;
  }

  .menu-item a,
  .sidebar-logout-btn {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* User Info Section in Sidebar */
.user-widget {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
}

.user-avatar {
  background: var(--primary-gradient);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-family: var(--font-header);
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.1rem;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.logout-btn:hover {
  color: var(--danger-color);
  transform: translateX(2px);
}

/* Content Frame */
.main-frame {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

/* Header */
.top-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  flex-wrap: wrap;
  /* O cabeçalho precisa manter sua altura quando o conteúdo da tela cresce. */
  flex: 0 0 auto;
}

.header-title-area {
  display: flex;
  flex-direction: column;
}

.header-title-area h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Seletor Multi-Empresa */
.company-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
}

.company-selector-wrapper i {
  color: var(--primary-color);
}

.company-selector {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-header);
  font-weight: 600;
  cursor: pointer;
  padding-right: 0.5rem;
}

.company-selector option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Conexão / Status PWA */
.network-status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--success-color);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse-dot-green 1.5s infinite;
}

.status-dot.offline {
  background-color: var(--danger-color);
  box-shadow: 0 0 8px var(--danger-glow);
  animation: pulse-dot-red 1.5s infinite;
}

/* Simulador de Rede & Botão de Perfil */
.net-simulator-btn,
.profile-toggle-btn,
.theme-toggle-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
}

.net-simulator-btn:hover,
.profile-toggle-btn:hover,
.theme-toggle-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.net-simulator-btn:hover i,
.profile-toggle-btn:hover i,
.theme-toggle-btn:hover i {
  color: #fff !important;
}

/* --- TELA DE LOGIN --- */
.login-wrapper {
  background: var(--login-background);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  animation: surface-enter var(--motion-slow) var(--ease-emphasized) both;
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
}

.login-theme-toggle span {
  white-space: nowrap;
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* Container da logo personalizada na tela de login */
.login-logo-container {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 90px !important;
  margin-bottom: 1rem !important;
  overflow: visible !important;
}

.login-logo-container img {
  max-height: 120px !important;
  max-width: 90% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 auto !important;
}

.login-logo {
  background: var(--primary-gradient);
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px var(--primary-glow);
  font-size: 1.75rem;
  color: #fff;
  margin-bottom: 0.5rem;
  animation: float 4s ease-in-out infinite;
}

.login-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-container > i {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  transition:
    color var(--transition-fast),
    transform var(--transition-fast);
}

.input-container input,
.input-container select,
.form-group textarea {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem 0.75rem 2.7rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

.form-group textarea {
  padding: 0.75rem 1rem;
  resize: vertical;
  min-height: 80px;
}

.input-container input:focus,
.input-container select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 8px var(--primary-glow);
  background: var(--bg-surface-elevated);
}

.input-container input:focus + i {
  color: var(--primary-color);
}

.login-btn {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal),
    filter var(--transition-normal);
  box-shadow: 0 4px 15px var(--primary-glow);
  margin-top: 0.5rem;
}

.login-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
  filter: none;
}

.login-btn:active {
  transform: translateY(0);
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-align: center;
  animation: shake 0.4s ease-in-out;
}

/* --- TELA PRINCIPAL (DASHBOARD & MURAL) --- */
.page-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
  animation: page-enter var(--motion-base) var(--ease-emphasized);
}

/* Abas de Configurações: ocupam toda a largura e não deixam o conteúdo
   da aba influenciar a organização da faixa de navegação. */
.config-tabs {
  width: 100%;
  flex: 0 0 auto;
  align-content: flex-start;
}

.config-tab-content {
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-focus);
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-header);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card.primary .stat-icon {
  background: rgba(22, 163, 74, 0.1);
  color: var(--primary-color);
}
.stat-card.success .stat-icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
}
.stat-card.danger .stat-icon {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
}
.stat-card.warning .stat-icon {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

/* MURAL DE ATENDIMENTO */
.mural-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mural-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mural-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.mural-card {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal),
    background-color var(--transition-normal);
  border-left: 4px solid var(--text-muted);
}

.mural-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mural-card.status-aguardando {
  border-left-color: var(--warning-color);
}

.mural-card.status-atendimento {
  border-left-color: var(--primary-color);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(22, 163, 74, 0.06) 100%);
}

.mural-card.status-concluido {
  border-left-color: var(--success-color);
  opacity: 0.8;
}

.mural-time {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mural-patient {
  font-size: 1rem;
  font-weight: 600;
}

.mural-professional {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mural-room {
  align-self: flex-start;
  background: var(--bg-surface-elevated);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning-color); }
.badge-primary,
.badge-success { background: rgba(22, 163, 74, 0.15); color: var(--primary-hover); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger-color); }

.protected-account-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
}

.no-actions-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

/* --- CONTROLES E BOTÕES DE MÓDULOS --- */
.section-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-header);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  justify-content: center;
  transition:
    transform var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
}

.btn:not(.btn-primary):not(.btn-success):not(.btn-danger):hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.btn:active,
.login-btn:active,
.sidebar-toggle-btn:active,
.profile-toggle-btn:active,
.net-simulator-btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  filter: none;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-success:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: 0 6px 14px var(--primary-glow);
  filter: none;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-color);
  border-color: transparent;
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: #fff;
  box-shadow: 0 4px 10px var(--danger-glow);
  filter: none;
  transform: translateY(-1px);
}

.btn:disabled,
.login-btn:disabled {
  background: var(--surface-hover);
  border-color: var(--border-color);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.btn:disabled:hover,
.login-btn:disabled:hover {
  background: var(--surface-hover);
  border-color: var(--border-color);
  color: var(--text-secondary);
  box-shadow: none;
  filter: none;
  transform: none;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  min-height: 44px;
}

.table-actions .btn-sm,
.btn-icon {
  min-width: 44px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.btn-icon:hover {
  color: var(--primary-color);
  background: var(--surface-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: scale(0.98);
}

/* Ações anexas aos selects de categoria/localização no cadastro de estoque. */
.input-container .stock-option-add-btn {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  min-width: 46px;
  padding: 0;
  color: var(--primary-color);
  border-color: color-mix(in srgb, var(--primary-color) 55%, var(--border-color));
}

.input-container .stock-option-add-btn i {
  position: static;
  color: currentColor;
  transform: none;
}

.input-container .stock-option-add-btn:hover {
  color: var(--primary-hover);
}

/* Campo de auditoria: reserva espaço para o acionador de leitura por câmera. */
#barcode-input {
  padding-right: 4.25rem !important;
}

body.scanner-open {
  overflow: hidden;
}

#modal-barcode-scanner,
#modal-stock-scanner {
  z-index: 5000;
  align-items: center;
}

#modal-barcode-scanner .scanner-modal-content,
#modal-stock-scanner .scanner-modal-content {
  max-width: 520px;
  text-align: left;
}

.scanner-preview {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #0f172a;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#barcode-scanner-video,
#stock-scanner-video {
  display: block;
  width: 100%;
  min-height: 260px;
  max-height: 55dvh;
  object-fit: cover;
  background: #0f172a;
}

.scanner-frame {
  position: absolute;
  inset: 18% 12%;
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.25);
  pointer-events: none;
}

.profile-dropdown-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  text-align: left;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.profile-dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--primary-color);
}

.profile-dropdown-logout {
  color: var(--danger-color);
}

.profile-dropdown-logout:hover {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.08);
}

.welcome-logo-fallback {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px var(--primary-glow);
  font-size: 3rem;
}

.welcome-company-title {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-top: 1rem;
}

.app-toast {
  animation: toast-enter var(--motion-base) var(--ease-emphasized) both;
}

.app-toast.is-leaving {
  animation: toast-exit var(--motion-fast) var(--ease-standard) both;
}

/* --- TABELAS E DATA GRID --- */
.table-responsive {
  width: 100%;
}

.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: var(--surface-subtle);
  padding: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-header);
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--table-row-hover);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

/* --- GRID DO ESTOQUE (PRATELEIRAS) --- */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-focus);
}

.product-card[role="button"] {
  cursor: pointer;
}

.product-card[role="button"]:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
}

.product-img {
  height: 140px;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-img i {
  font-size: 3rem;
  color: var(--text-muted);
}

.product-price-badge {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: var(--primary-gradient);
  color: #fff;
  padding: 0.25rem 0.5rem;
  font-family: var(--font-header);
  font-weight: 700;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.product-info {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.product-name {
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-code {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.product-location {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.product-qty-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.product-qty {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-header);
}

.product-qty.low {
  color: var(--danger-color);
  animation: text-pulse-red 2s infinite;
}

/* --- KANBAN BOARD (PLANNER DE TAREFAS) --- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 768px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.kanban-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 400px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.kanban-column-title {
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kanban-column-count {
  background: var(--bg-surface-elevated);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.kanban-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 300px;
}

.task-card {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: grab;
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal);
}

.task-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.task-priority-badge {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

.task-priority-alta { background: rgba(239, 68, 68, 0.15); color: var(--danger-color); }
.task-priority-media { background: rgba(245, 158, 11, 0.15); color: var(--warning-color); }
.task-priority-baixa { background: rgba(16, 185, 129, 0.15); color: var(--success-color); }

.task-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.task-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.task-assignee {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* --- TELA FINANCEIRA --- */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .finance-summary {
    grid-template-columns: 1fr;
  }
}

.finance-card {
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.finance-card.receitas {
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-left: 4px solid var(--success-color);
}

.finance-card.despesas {
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-left: 4px solid var(--danger-color);
}

.finance-card.saldo {
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(22, 163, 74, 0.05) 100%);
  border-left: 4px solid var(--primary-color);
}

/* --- MODAIS --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 550px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 3rem);
  margin: auto;
  overflow: hidden;
  animation: scaleIn var(--motion-base) var(--ease-emphasized) both;
}

/* Formulários que possuem corpo rolável e rodapé fixo dentro do modal. */
.modal-content > form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--danger-color);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* --- ANIMATIONS --- */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes pulse-dot-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-dot-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes surface-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes text-pulse-red {
  0%, 100% { color: var(--text-primary); }
  50% { color: var(--danger-color); }
}

/* --- CLASSES DE RESPONSIVIDADE DE GRID PARA FORMULÁRIOS --- */
.grid-2-col,
.grid-3-col,
.grid-1-2-col,
.grid-3-1-col {
  display: grid;
  gap: 1rem;
}

.grid-2-col {
  grid-template-columns: 1fr 1fr;
}

.grid-3-col {
  grid-template-columns: 1.2fr 1fr 1fr;
}

.grid-1-2-col {
  grid-template-columns: 1.2fr 1fr;
}

.grid-3-1-col {
  grid-template-columns: 3fr 1fr;
}

/* --- OVERRIDES RESPONSIVOS PARA MOBILE --- */
@media (max-width: 768px) {
  /* Cabeçalho Responsivo em 1 linha compacta */
  .top-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 0.5rem !important;
    padding: 0.6rem 0.85rem !important;
  }
  
  .header-first-line {
    width: 100% !important;
  }
  
  .support-tool, .hide-on-mobile {
    display: none !important;
  }
  
  .page-content {
    padding: 0.75rem 0.5rem !important;
    box-sizing: border-box !important;
    max-width: 100vw !important;
    gap: 1rem !important;
  }
  
  .nav-tabs-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    white-space: normal !important;
    padding-bottom: 0.75rem !important;
    margin-bottom: 0 !important;
    gap: 0.5rem !important;
  }
  
  .nav-tabs-wrapper .btn {
    flex: 1 1 calc(50% - 0.5rem) !important;
    white-space: normal !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 0.5rem !important;
    font-size: 0.82rem !important;
    line-height: 1.2 !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
  }

  .nav-tabs-wrapper .btn:not(.btn-primary) {
    box-shadow: none !important;
  }
  
  .nav-tabs-wrapper::-webkit-scrollbar {
    display: none !important;
  }
  
  .nav-tabs-wrapper::-webkit-scrollbar-thumb {
    display: none !important;
  }

  .section-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  
  .search-actions-container {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }
  
  .search-input-field {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 0.5rem;
  }
  
  .search-actions-container .btn {
    flex: 1 1 auto !important;
    justify-content: center;
    text-align: center;
  }

  .header-subtitle {
    display: none !important;
  }

  .header-title-area h2 {
    font-size: 1.15rem !important;
  }
  
  .header-controls {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
    box-sizing: border-box !important;
  }
  
  .company-selector-wrapper {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .company-selector {
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .network-status-badge {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  .profile-dropdown-wrapper {
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    margin-left: auto !important;
  }

  .profile-toggle-btn {
    width: 44px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  .company-selector-wrapper,
  .network-status-badge,
  .net-simulator-btn,
  .profile-toggle-btn,
  .theme-toggle-btn {
    flex-grow: 0 !important;
    font-size: 0.75rem !important;
    padding: 0.35rem 0.6rem !important;
  }

  .sidebar-toggle-btn,
  .profile-toggle-btn,
  .net-simulator-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /* Estatísticas em 1 coluna */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Grids de formulário e layouts empilhados em 1 coluna no mobile (< 768px) */
  .grid-2-col,
  .grid-3-col,
  .grid-1-2-col,
  .grid-3-1-col {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Enquadramento responsivo perfeito de modais no celular */
  .modal-container {
    padding: 0.5rem !important;
  }
  
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--radius-md) !important;
    box-sizing: border-box !important;
  }
  
  .modal-body {
    padding: 1rem 0.75rem !important;
    max-height: 75vh !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  
  .modal-body select,
  .modal-body input,
  .modal-body button {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .modal-body select {
    min-width: 0 !important;
  }

  /* Sobrescrever grades inline em formulários do estoque */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Transforma tabelas de dados em Cards Responsivos Empilhados no celular */
  .data-table, 
  .data-table tbody, 
  .data-table tr, 
  .data-table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .data-table thead {
    display: none !important;
  }

  .data-table tr {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 1rem !important;
    padding: 0.75rem 1rem !important;
    box-shadow: none;
  }

  .data-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.5rem 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
    font-size: 0.85rem !important;
    text-align: right !important;
    white-space: normal !important;
    word-break: break-word !important;
    max-width: 100% !important;
  }

  .data-table td:last-child {
    border-bottom: none !important;
    padding-top: 0.75rem !important;
    justify-content: flex-end !important;
  }

  .data-table td[data-label]::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }

  .table-responsive,
  .table-wrapper {
    width: 100%;
    overflow-x: hidden !important;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 576px) {
  /* Enquadramento Responsivo e Elegante da Tela de Login para Celular */
  .login-wrapper {
    padding: 1rem !important;
    align-items: flex-start !important;
    padding-top: 6vh !important;
    padding-bottom: 6vh !important;
  }
  .login-card {
    padding: 1.75rem 1.25rem !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 1.25rem !important;
  }
  .login-logo-container {
    min-height: 70px !important;
    margin-bottom: 0.5rem !important;
  }
  .login-logo-container img {
    max-height: 85px !important;
  }
  .login-header h1 {
    font-size: 1.5rem !important;
  }

  /* Modais ocupam tela cheia com pequena margem */
  .modal-overlay {
    padding: 0.5rem !important;
  }
  
  .modal-content {
    max-width: 100% !important;
    max-height: 95vh !important;
  }

  .modal-body {
    padding: 1rem !important;
    max-height: 70vh !important;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem !important;
  }

  #modal-barcode-scanner,
  #modal-stock-scanner {
    padding: 0 !important;
    align-items: stretch;
    background: var(--bg-base);
  }

  #modal-barcode-scanner .scanner-modal-content,
  #modal-stock-scanner .scanner-modal-content {
    height: 100dvh;
    max-height: 100dvh !important;
    border: 0;
    border-radius: 0 !important;
    background: var(--bg-surface);
  }

  #modal-barcode-scanner .modal-body,
  #modal-stock-scanner .modal-body {
    display: flex;
    flex-direction: column;
    max-height: none !important;
    padding: 0.75rem !important;
  }

  #modal-barcode-scanner .scanner-preview,
  #modal-stock-scanner .scanner-preview {
    flex: 1 1 auto;
    min-height: 50dvh;
    border-radius: var(--radius-sm);
  }

  #barcode-scanner-video,
  #stock-scanner-video {
    width: 100%;
    height: 100%;
    min-height: 50dvh;
    max-height: none;
  }

  /* Detalhes de prontuário e ficha */
  #view-patient-details-body {
    padding: 1rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
