/* ============================================================
   MaxinteligencIA 2026 — Style System
   Branding: Maxwell Fernandes — 'Tech Humanizada'
   Fonts: Montserrat (títulos) + Inter (corpo)
   Primária: Deep Cobalt Blue #002060
   Destaque: Coral #FF6F61
   Fundo: Light Gray #F4F7F6
   ============================================================ */

:root {
  --cobalt:        #002060;
  --cobalt-mid:    #0a3080;
  --cobalt-light:  #1a4aa0;
  --coral:         #FF6F61;
  --coral-hover:   #e85d50;
  --bg:            #F4F7F6;
  --card-bg:       #ffffff;
  --border:        #e8edf2;
  --text-main:     #0d1b2a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --green:         #22c55e;
  --purple:        #8b5cf6;
  --radius:        14px;
  --radius-sm:     8px;
  --shadow:        0 4px 16px rgba(0, 32, 96, 0.08);
  --shadow-hover:  0 8px 30px rgba(0, 32, 96, 0.14);
  --sidebar-w:     270px;
  --transition:    all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================ SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--cobalt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  padding: 2rem 1.25rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  background: var(--coral);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 111, 97, 0.4);
}

.sidebar-brand h2 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-brand span {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* Nav */
.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  transform: translateX(3px);
}

.nav-item.active {
  background: rgba(255, 111, 97, 0.18);
  color: #fff;
  border-left: 3px solid var(--coral);
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sync-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.btn-sync {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
}

.btn-sync:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

/* ============================================================ MAIN */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.5rem 3rem;
  min-height: 100vh;
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}

.main-header h1 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1.875rem;
  color: var(--cobalt);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.main-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.date-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow);
}

/* Loader */
.loader-container {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  gap: 1rem;
}

.loader-container.visible {
  display: flex;
}

.loader-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--border);
  border-top-color: var(--cobalt);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================ SECTIONS */
.section { display: none; }
.section.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================ KPI CARDS */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon svg { width: 22px; height: 22px; }

.icon-blue   { background: rgba(0,32,96,0.08);   color: var(--cobalt); }
.icon-coral  { background: rgba(255,111,97,0.12); color: var(--coral); }
.icon-green  { background: rgba(34,197,94,0.1);  color: #15803d; }
.icon-purple { background: rgba(139,92,246,0.1); color: var(--purple); }

.kpi-body { display: flex; flex-direction: column; gap: 2px; }

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-value {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--cobalt);
  line-height: 1;
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* ============================================================ CARDS */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--cobalt);
}

.card-badge {
  background: rgba(0,32,96,0.06);
  color: var(--cobalt-mid);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ============================================================ CHARTS */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.5rem;
}

.chart-card { }

.chart-wrapper {
  padding: 1.5rem 1.75rem;
  height: 280px;
  position: relative;
}

/* ============================================================ TABLE */
.header-filters {
  display: flex;
  gap: 0.75rem;
}

.header-filters select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--text-main);
  background: var(--bg);
  cursor: pointer;
  outline: none;
}

.table-container {
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 1rem 1.5rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  z-index: 5;
}

tbody td {
  padding: 1rem 1.5rem;
  font-size: 0.84rem;
  color: var(--text-main);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

tbody tr:hover { background: #f8fafc; }

.table-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.table-footer {
  padding: 1rem 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  text-align: right;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-resolvido   { background: #dcfce7; color: #166534; }
.badge-pendente    { background: #fef9c3; color: #854d0e; }
.badge-escalado    { background: #fee2e2; color: #991b1b; }
.badge-outro       { background: #f1f5f9; color: #475569; }

/* ============================================================ RANKING LIST */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.ranking-pos {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--cobalt-light);
  width: 28px;
  text-align: center;
}

.ranking-name { flex: 1; font-weight: 500; font-size: 0.9rem; }

.ranking-bar-wrap {
  flex: 2;
  background: var(--border);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
}

.ranking-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cobalt), var(--cobalt-light));
  border-radius: 100px;
  transition: width 0.6s ease;
}

.ranking-count {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--cobalt);
  min-width: 40px;
  text-align: right;
}

/* ============================================================ RELATÓRIO */
.relatorio-info { padding: 1rem 0; }

.relatorio-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.relatorio-icon { font-size: 2.5rem; }

.relatorio-item h4 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: var(--cobalt);
  margin-bottom: 0.5rem;
}

.relatorio-item p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }

.relatorio-tags { display: flex; gap: 0.5rem; margin-top: 1rem; }

.tag {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(0,32,96,0.08);
  color: var(--cobalt);
}

.tag-green { background: rgba(34,197,94,0.1); color: #166534; }

/* ============================================================ SCROLLBAR */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
