:root{
  --bg: #0a0f1f;
  --bg-gradient: linear-gradient(135deg, #070a15 0%, #0f1529 100%);
  --card-bg: rgba(17, 24, 39, 0.85);
  --card-border: rgba(56, 72, 107, 0.4);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --glass-effect: rgba(255, 255, 255, 0.05);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #f97316;
  --accent-gradient: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  margin: 0;
  background: var(--bg-gradient);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animação de fundo sutil */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(249, 115, 22, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(56, 189, 248, 0.03) 0%, transparent 40%);
  z-index: -1;
  pointer-events: none;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header moderno */
.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.title::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.title h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.title .sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
  max-width: 700px;
}

/* Pill badge moderno */
.title .pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 50px;
  color: var(--accent-primary);
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  transition: var(--transition);
  white-space: nowrap;
}

.title .pill:hover {
  background: rgba(249, 115, 22, 0.2);
  transform: translateY(-2px);
}

/* Card design moderno */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(249, 115, 22, 0.3);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-gradient);
  opacity: 0.5;
}

/* Form elements modernos */
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

label {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

select, input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(11, 18, 34, 0.7);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
  background: rgba(11, 18, 34, 0.9);
}

/* Botões modernos */
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  background: var(--accent-gradient);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Error message moderno */
.err {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 20px;
  border-radius: 12px;
  color: #fecaca;
  margin: 20px 0;
  backdrop-filter: blur(10px);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* KPI cards modernos */
.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.k {
  background: rgba(11, 18, 34, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.k:hover {
  border-color: rgba(249, 115, 22, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.k .t {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.k .v {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

/* Tabs modernos */
.tabs {
  display: flex;
  gap: 4px;
  margin: 32px 0 24px;
  padding: 6px;
  background: rgba(11, 18, 34, 0.7);
  border-radius: 14px;
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid transparent;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  background: var(--accent-gradient);
  color: white;
  border-color: rgba(249, 115, 22, 0.3);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}

/* Tabelas modernas */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 20px;
  background: rgba(11, 18, 34, 0.5);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

th {
  background: rgba(17, 24, 39, 0.8);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--card-border);
}

td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  transition: var(--transition);
}

tr:hover td {
  background: rgba(249, 115, 22, 0.05);
}

tr:last-child td {
  border-bottom: none;
}

/* Split layout */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

/* Section headers */
.section-title {
  margin-top: 32px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.hr {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-border), transparent);
  margin: 20px 0;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(11, 18, 34, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #fb923c;
}

/* Animações para elementos que aparecem */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.k, .tab, .btn {
  animation: fadeInUp 0.4s ease-out backwards;
}

.k:nth-child(2) { animation-delay: 0.1s; }
.k:nth-child(3) { animation-delay: 0.2s; }
.tab:nth-child(2) { animation-delay: 0.05s; }
.tab:nth-child(3) { animation-delay: 0.1s; }
.tab:nth-child(4) { animation-delay: 0.15s; }

/* Responsividade */
@media (max-width: 768px) {
  .wrap {
    padding: 16px;
  }
  
  .title {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }
  
  .title h1 {
    font-size: 24px;
  }
  
  .title .pill {
    align-self: flex-start;
  }
  
  .card {
    padding: 20px;
  }
  
  .tabs {
    flex-wrap: wrap;
  }
  
  .tab {
    min-width: calc(50% - 8px);
  }
}

@media (max-width: 480px) {
  .title h1 {
    font-size: 20px;
  }
  
  .tab {
    min-width: 100%;
  }
  
  .kpi {
    grid-template-columns: 1fr;
  }
  
  .split {
    grid-template-columns: 1fr;
  }
  
  .row {
    grid-template-columns: 1fr;
  }
}