/* === InspectorPRO NR-13 — Production Master Layout V108.15 === */
:root {
  --bg-darker: #050811;
  --bg-dark: #0b0f19;
  --accent-cyan: var(--brand-accent-bright, #00f0ff);
  --text-slate: #cbd5e1;
  --sidebar-w: 260px;
}

body {
  background: var(--bg-darker) !important;
  color: #fff;
  margin: 0;
  overflow-x: hidden !important;
}

#sidebar {
  width: var(--sidebar-w) !important;
  min-width: var(--sidebar-w) !important;
  flex: 0 0 var(--sidebar-w) !important;
  background: linear-gradient(180deg, #080d1a 0%, #0a1224 40%, #0c152a 100%) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  height: 100vh;
  /* [R587] dono: "o menu lateral acompanhe o ajuste da tela... apareça 100%".
     dvh acompanha a barra dinâmica do navegador (100vh esconde o fim do menu
     no celular); o min-height:0 do nav abaixo destrava o scroll interno. */
  height: 100dvh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10000;
  border-right: 1px solid rgba(0, 240, 255, 0.12) !important;
  display: flex !important;
  flex-direction: column;
}

/* [R587] flex:1 SEM min-height:0 não ativa overflow (bug flex clássico): em
   tela baixa/zoom os últimos itens ficavam CORTADOS sem conseguir rolar. */
#sidebar > nav {
  min-height: 0 !important;
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.35) transparent;
}
#sidebar > nav::-webkit-scrollbar { width: 5px; }
#sidebar > nav::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.35); border-radius: 4px; }

.sidebar-header {
  padding: 30px 20px;
  display: flex !important;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
  width: 50px !important; /* Mini-logo like production screenshot */
  height: auto !important;
  object-fit: contain;
}

.nav-item {
  display: flex !important;
  align-items: center;
  padding: 14px 20px;
  color: var(--text-slate) !important;
  text-decoration: none !important;
  font-weight: 500;
  margin-right: 15px;
  border-radius: 0 30px 30px 0;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 12px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #fff !important;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.15) 0%, rgba(0, 240, 255, 0.02) 100%) !important;
  /* [R1142] "veja como fica quando tem algo selecionado" (print do dono, 02/09): a
     var --accent-cyan não resolvia em parte das telas e o item ATIVO herdava cinza
     apagado — o selecionado era o ÚNICO ilegível do menu. Fallback cravado. */
  color: var(--accent-cyan, #00e5ff) !important;
  border-left: 3px solid var(--accent-cyan, #00e5ff) !important;
  font-weight: 700;
}

.page {
  margin-left: 0 !important;
  width: 100% !important;
  padding: 24px !important;
  box-sizing: border-box !important;
  min-height: 100vh;
  background: var(--bg-dark);
}

/* Fix Big Tiles on Dashboard (Restoring Improvements) */
.dashboard-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.tile {
  position: relative;
  height: 150px;
  border-radius: 20px;
  padding: 24px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.tile:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.45), 0 0 20px rgba(0, 240, 255, 0.15) !important;
}

.tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 12px;
  transition: all 0.3s;
}

.tile:hover .tile-icon {
  background: rgba(0, 240, 255, 0.15);
  transform: scale(1.1);
}

.tile-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-display);
}

.tile-desc {
  margin: 4px 0 0 0;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Glassmorphism & Budget Specifics (V108.25) */
.glass-card {
  background: rgba(13, 20, 35, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 240, 255, 0.08) !important;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.45), 0 0 15px rgba(0, 240, 255, 0.03);
}

.budget-status-badge {
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-aprovado { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-pendente { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-rejeitado { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Financial Dashboard Consistency */
.financial-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-item {
  background: rgba(30, 41, 59, 0.5);
  border-left: 4px solid var(--accent-cyan);
  padding: 20px;
  border-radius: 12px;
}

/* Dashboard Overhaul (V108.26) */
.kpi-card {
  background: rgba(13, 20, 35, 0.55) !important;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 240, 255, 0.08) !important;
  border-radius: 20px;
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.kpi-card-interactive {
  background: rgba(13, 20, 35, 0.55) !important;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 240, 255, 0.08) !important;
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.kpi-card-interactive:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.45), 0 0 20px rgba(0, 240, 255, 0.12) !important;
}

.kpi-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  color: #e2e8f0;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--brand-accent-bright, #00f0ff);
  letter-spacing: -0.5px;
}

.kpi-card-small {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 15px;
}

.kpi-label-small {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.kpi-value-small {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

/* 8-TILE GRID ENGINE */
.dashboard-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 20px;
}

.module-tile {
  position: relative;
  height: 180px;
  border-radius: 24px;
  padding: 24px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(0, 240, 255, 0.08);
  background: rgba(13, 20, 35, 0.5);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.module-tile:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(0, 240, 255, 0.25);
  box-shadow: 0 20px 40px -15px rgba(0,0,0,0.6), 0 0 20px rgba(0, 240, 255, 0.1);
}

.module-tile .icon {
  font-size: 2.5rem;
  margin-bottom: auto;
  opacity: 0.9;
}

.module-tile .title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.module-tile .desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* Glassmorphic Color Variants for Tiles */
.tile-blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.02)) !important;
  border: 1px solid rgba(59, 130, 246, 0.2) !important;
}
.tile-blue:hover { border-color: rgba(59, 130, 246, 0.45) !important; }

.tile-green {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.02)) !important;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
}
.tile-green:hover { border-color: rgba(16, 185, 129, 0.45) !important; }

.tile-orange {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.02)) !important;
  border: 1px solid rgba(245, 158, 11, 0.2) !important;
}
.tile-orange:hover { border-color: rgba(245, 158, 11, 0.45) !important; }

.tile-cyan {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(6, 182, 212, 0.02)) !important;
  border: 1px solid rgba(6, 182, 212, 0.2) !important;
}
.tile-cyan:hover { border-color: rgba(6, 182, 212, 0.45) !important; }

.tile-purple {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(139, 92, 246, 0.02)) !important;
  border: 1px solid rgba(139, 92, 246, 0.2) !important;
}
.tile-purple:hover { border-color: rgba(139, 92, 246, 0.45) !important; }

.tile-slate {
  background: linear-gradient(135deg, rgba(71, 85, 105, 0.12), rgba(71, 85, 105, 0.02)) !important;
  border: 1px solid rgba(71, 85, 105, 0.2) !important;
}
.tile-slate:hover { border-color: rgba(71, 85, 105, 0.45) !important; }

.tile-teal {
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.12), rgba(14, 116, 144, 0.02)) !important;
  border: 1px solid rgba(14, 116, 144, 0.2) !important;
}
.tile-teal:hover { border-color: rgba(14, 116, 144, 0.45) !important; }

.tile-pink {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(236, 72, 153, 0.02)) !important;
  border: 1px solid rgba(236, 72, 153, 0.2) !important;
}
.tile-pink:hover { border-color: rgba(236, 72, 153, 0.45) !important; }

/* === TABELAS PREMIUM — HOVER EFFECTS === */
.premium-table tr {
  transition: background 0.2s ease;
}

.premium-table tr:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}

/* === MODAL & TOGGLE UI — BUDGET MODERNIZATION === */
.segmented-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 15px;
}

.toggle-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: #0ea5e9;
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.discount-badge-premium {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.strike-price-premium {
  font-size: 0.75rem;
  color: #94a3b8;
  text-decoration: line-through;
  opacity: 0.7;
}

.margin-health-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.margin-health-fill {
  height: 100%;
  transition: width 0.4s ease, background-color 0.4s ease;
}

/* === CAMPOS OBRIGATÓRIOS — VISUAL DIFERENCIADO === */
/* Labels com asterisco (*) = obrigatório */
.form-group label:has(+ [required]),
.form-group label:has(+ select[required]) {
  color: #e2e8f0;
}

/* Input/Select obrigatório: borda sutil diferenciada */
.form-control-premium[required] {
  border-left: 3px solid rgba(var(--brand-accent-rgb, 0, 212, 255), 0.5) !important;
}

/* Campo com erro de validação — borda vermelha pulsante */
.field-error {
  border: 1.5px solid #ef4444 !important;
  border-left: 3px solid #ef4444 !important;
  animation: field-error-pulse 1.5s ease-in-out 3;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3) !important;
}

@keyframes field-error-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.5); }
}

/* Remover erro ao focar */
.field-error:focus {
  border-color: var(--brand-accent, #00d4ff) !important;
  box-shadow: 0 0 8px rgba(var(--brand-accent-rgb, 0, 212, 255), 0.3) !important;
  animation: none;
}

/* === SOBREPOSIÇÕES PARA TODOS OS MÓDULOS (ESTILO DE VANGUARDA) === */

/* Form Control Global Overrides */
.page input[type="text"], 
.page input[type="password"], 
.page input[type="email"], 
.page input[type="number"], 
.page input[type="tel"], 
.page input[type="date"], 
.page select, 
.page textarea {
  background: rgba(11, 19, 36, 0.55) !important;
  border: 1px solid rgba(0, 240, 255, 0.15) !important;
  border-radius: 12px !important;
  color: #fff !important;
  padding: 12px 16px !important;
  outline: none !important;
  font-family: inherit;
  font-size: 0.9rem !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.page input::placeholder {
  color: rgba(255, 255, 255, 0.35) !important;
}

.page input:focus, 
.page select:focus, 
.page textarea:focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25) !important;
  background: rgba(11, 19, 36, 0.75) !important;
}

/* Modais Glassmorphism */
.modal, [id^="modal-"], .modal-overlay {
  background: rgba(4, 7, 15, 0.75) !important;
  backdrop-filter: blur(15px) !important;
  -webkit-backdrop-filter: blur(15px) !important;
  overflow-y: auto !important;
  padding: 40px 20px !important;
  box-sizing: border-box !important;
}

/* Modal Content Card override */
.modal > div, [id^="modal-"] > div {
  background: rgba(11, 19, 36, 0.92) !important;
  border: 1px solid rgba(0, 240, 255, 0.2) !important;
  border-radius: 24px !important;
  box-shadow: 0 24px 64px 0 rgba(0, 0, 0, 0.65), 0 0 30px rgba(0, 240, 255, 0.05) !important;
  color: #fff !important;
  margin: auto !important; /* Centering with scrollbar support */
  max-height: calc(100vh - 80px) !important; /* Prevents overflow cropping */
  overflow-y: auto !important; /* Internal scroll fallback */
  box-sizing: border-box !important;
}

/* Tabelas Premium Globais */
.page table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: transparent !important;
}

.page thead tr {
  border-bottom: 2px solid rgba(0, 240, 255, 0.15) !important;
}

.page th {
  padding: 14px 16px !important;
  color: #94a3b8 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px;
}

.page td {
  padding: 14px 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  color: #e2e8f0 !important;
  font-size: 0.85rem !important;
}

.page tbody tr {
  transition: all 0.2s ease;
  background: transparent !important;
}

.page tbody tr:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

/* Sleek Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.15) #050811;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.15);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.3);
}

/* Segmented Tab Controls */
.segmented-toggle {
  display: flex;
  background: rgba(13, 20, 35, 0.6) !important;
  border: 1px solid rgba(0, 240, 255, 0.12) !important;
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
  margin-bottom: 24px;
}

.toggle-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--brand-accent, #00d4ff), #0066ff) !important;
  color: #050811 !important;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(var(--brand-accent-rgb, 0, 212, 255), 0.25) !important;
}

.toggle-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

/* Estilo do painel do Dashboard */
.db-panel {
  display: none;
  animation: fadeIn 0.35s ease-out forwards;
}

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

/* === LOGIN PAGE PREMIUM INPUTS (Ghost Screen Fix) === */
.premium-input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(30, 41, 59, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 16px !important;
  color: #fff !important;
  font-size: 1rem !important;
  outline: none !important;
  transition: all 0.3s ease !important;
  box-sizing: border-box;
}

.premium-input:focus {
  border-color: var(--brand-accent, #00d4ff) !important;
  box-shadow: 0 0 12px rgba(var(--brand-accent-rgb, 0, 212, 255), 0.25) !important;
  background: rgba(30, 41, 59, 0.95) !important;
}

.premium-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--brand-accent, #00d4ff), #0066ff) !important;
  color: #0a0f1c !important;
  font-weight: 800 !important;
  border: none !important;
  border-radius: 16px !important;
  font-size: 1.1rem !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box;
}

.premium-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--brand-accent-rgb, 0, 212, 255), 0.4) !important;
}
/* ==========================================================================
   [R467] CAMADA DE AVISO FLUTUANTE À ESQUERDA
   Print do dono (2026-07-27): "veja uma mensagem roxa escondida atras do menu".
   O #sidebar é `position:fixed; left:0; width:260px; z-index:10000`. Todo aviso
   ancorado em `left:20px` com z-index menor nasce ATRÁS do menu — o dono nunca
   lê. Aconteceu com o banner de contas recorrentes (z-index 9000) e com o
   indicador de OFFLINE (9999), que é justamente o que ele mais precisa ver.
   Agora existe UM lugar que define onde esse canto começa.
   ========================================================================== */
.aviso-flutuante-esq {
  position: fixed !important;
  left: calc(var(--sidebar-w, 260px) + 20px) !important;
  z-index: 10050 !important;              /* acima do #sidebar (10000) */
  max-width: min(380px, calc(100vw - var(--sidebar-w, 260px) - 40px)) !important;
}

/* Abaixo de 1150px o menu vira gaveta (sai da tela): o canto esquerdo é livre. */
@media (max-width: 1150px) {
  .aviso-flutuante-esq {
    left: 16px !important;
    max-width: calc(100vw - 32px) !important;
  }
}
