/* ==========================================================
   1. DESIGN TOKENS
   ========================================================== */
:root{
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --primary-light: #EEF2FF;
  --secondary: #06B6D4;
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;

  --bg: #F8FAFC;
  --card: #FFFFFF;
  --border: #E2E8F0;

  --text: #0F172A;
  --sub: #64748B;
  --sub-light: #94A3B8;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.06), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 20px 40px -12px rgba(79,70,229,0.18);
  --shadow-glow: 0 0 0 4px rgba(79,70,229,0.08);
}

*{box-sizing:border-box;}

html{scroll-behavior:smooth;}

body{
  margin:0;
  font-family:'Inter',sans-serif;
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  min-height:100vh;
}

/* ==========================================================
   2. FUNDO DECORATIVO (gradiente + blur + formas abstratas)
   ========================================================== */
.bg-decor{
  position:fixed;
  inset:0;
  z-index:-1;
  overflow:hidden;
  background:
    radial-gradient(circle at 15% 10%, rgba(79,70,229,0.07), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(6,182,212,0.07), transparent 45%),
    linear-gradient(180deg,#F8FAFC 0%, #F1F5F9 100%);
}

.bg-decor span{
  position:absolute;
  border-radius:50%;
  filter:blur(60px);
  opacity:0.35;
}

.bg-decor .c1{ width:420px; height:420px; top:-120px; left:-100px; background:var(--primary); opacity:0.10; }
.bg-decor .c2{ width:360px; height:360px; top:20%; right:-140px; background:var(--secondary); opacity:0.10; }
.bg-decor .c3{ width:300px; height:300px; bottom:-100px; left:30%; background:var(--success); opacity:0.06; }

/* ==========================================================
   3. LAYOUT BASE
   ========================================================== */
.container{
  padding:28px 34px 60px;
  max-width:1400px;
  margin:0 auto;
  animation:fadeIn .6s ease;
}

/* ==========================================================
   4. HEADER
   ========================================================== */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  margin-bottom:28px;
  flex-wrap:wrap;
}

.topbar-left h1{
  margin:0;
  font-size:26px;
  font-weight:800;
  letter-spacing:-0.5px;
}

.topbar-left .greeting{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  color:var(--sub);
  margin-top:4px;
}

.topbar-left .greeting b{ color:var(--text); font-weight:600; }

.topbar-right{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}

.search-box{
  display:flex;
  align-items:center;
  gap:8px;
  background:rgba(255,255,255,0.7);
  backdrop-filter:blur(10px);
  border:1px solid var(--border);
  padding:9px 14px;
  border-radius:12px;
  box-shadow:var(--shadow-sm);
  min-width:220px;
  transition:.25s;
}

.search-box:focus-within{
  border-color:var(--primary);
  box-shadow:var(--shadow-glow);
}

.search-box input{
  border:none;
  outline:none;
  background:transparent;
  font-family:'Inter',sans-serif;
  font-size:13.5px;
  width:100%;
  color:var(--text);
}

.search-box i, .search-box svg{ color:var(--sub-light); width:16px; height:16px; }

.icon-btn{
  position:relative;
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.7);
  backdrop-filter:blur(10px);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow:var(--shadow-sm);
  transition:.25s;
  color:var(--sub);
}

.icon-btn:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-md);
  color:var(--primary);
  border-color:var(--primary-light);
}

.icon-btn svg{ width:18px; height:18px; }

.icon-btn .dot{
  position:absolute;
  top:8px;
  right:9px;
  width:7px;
  height:7px;
  border-radius:50%;
  background:var(--error);
  border:2px solid #fff;
}

.avatar{
  width:40px;
  height:40px;
  border-radius:12px;
  background:linear-gradient(135deg,var(--primary),var(--secondary));
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:14px;
  box-shadow:var(--shadow-md);
  cursor:pointer;
}

/* ==========================================================
   5. STAT CARDS (indicadores)
   ========================================================== */
.stats-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:16px;
  margin-bottom:26px;
}

.stat-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:20px 22px;
  box-shadow:var(--shadow-sm);
  transition:.3s;
  animation:fadeUp .5s ease both;
  position:relative;
  overflow:hidden;
}

.stat-card:hover{
  transform:translateY(-4px);
  box-shadow:var(--shadow-md);
  border-color:var(--primary-light);
}

.stat-card .stat-icon{
  width:38px;
  height:38px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:14px;
}

.stat-card .stat-icon svg{ width:18px; height:18px; }

.stat-card .stat-label{
  font-size:12.5px;
  color:var(--sub);
  font-weight:500;
}

.stat-card .stat-value{
  font-size:28px;
  font-weight:800;
  letter-spacing:-0.8px;
  margin:4px 0 2px;
}

.stat-card .stat-delta{
  font-size:12px;
  font-weight:600;
  display:inline-flex;
  align-items:center;
  gap:4px;
}

.icon-indigo{ background:var(--primary-light); color:var(--primary); }
.icon-cyan{ background:#ECFEFF; color:var(--secondary); }
.icon-green{ background:#F0FDF4; color:var(--success); }
.icon-amber{ background:#FFFBEB; color:var(--warning); }
.icon-red{ background:#FEF2F2; color:var(--error); }

.delta-up{ color:var(--success); }
.delta-down{ color:var(--error); }
.delta-neutral{ color:var(--sub); }

/* ==========================================================
   6. MENU CARDS
   ========================================================== */
.section-title{
  font-size:15px;
  font-weight:700;
  color:var(--text);
  margin:6px 0 14px;
  letter-spacing:-0.2px;
}

.cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:18px;
  margin-bottom:32px;
}

.card{
  position:relative;
  background:var(--card);
  border:1px solid var(--border);
  padding:26px 24px;
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-sm);
  cursor:pointer;
  transition:all .35s cubic-bezier(.2,.8,.2,1);
  overflow:hidden;
  animation:fadeUp .6s ease both;
}

.card::before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(135deg, rgba(79,70,229,0.06), rgba(6,182,212,0.04));
  opacity:0;
  transition:.35s;
}

.card:hover{
  transform:translateY(-8px);
  box-shadow:var(--shadow-lg);
  border-color:var(--primary-light);
}

.card:hover::before{ opacity:1; }

.card:active{ transform:translateY(-4px) scale(0.98); }

.card .card-icon{
  width:52px;
  height:52px;
  border-radius:14px;
  background:var(--primary-light);
  color:var(--primary);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  margin-bottom:16px;
  transition:.3s;
  position:relative;
  z-index:1;
}

.card:hover .card-icon{
  transform:scale(1.12) rotate(-4deg);
  background:var(--primary);
  color:#fff;
}

.card .card-icon svg{ width:24px; height:24px; }

.card h4{
  margin:0 0 4px;
  font-size:16px;
  font-weight:700;
  position:relative;
  z-index:1;
}

.card p{
  margin:0 0 18px;
  font-size:13px;
  color:var(--sub);
  position:relative;
  z-index:1;
}

.card .card-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  font-weight:600;
  color:var(--primary);
  background:var(--primary-light);
  padding:8px 16px;
  border-radius:10px;
  border:none;
  cursor:pointer;
  transition:.25s;
  position:relative;
  z-index:1;
}

.card:hover .card-btn{
  background:var(--primary);
  color:#fff;
}

/* ripple */
.ripple{
  position:absolute;
  border-radius:50%;
  background:rgba(79,70,229,0.25);
  transform:scale(0);
  animation:ripple .6s ease-out;
  pointer-events:none;
}

@keyframes ripple{
  to{ transform:scale(3); opacity:0; }
}

/* ==========================================================
   7. DASHBOARD GRID / BOXES
   ========================================================== */
.dashboard{
  display:grid;
  grid-template-columns:1.3fr 1fr;
  gap:20px;
  margin-bottom:20px;
}

.box{
  background:var(--card);
  border:1px solid var(--border);
  padding:24px;
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-sm);
  transition:.3s;
  animation:fadeUp .6s ease both;
}

.box:hover{ box-shadow:var(--shadow-md); }

.box-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:18px;
}

.box h3{
  margin:0;
  font-weight:700;
  font-size:15.5px;
}

.box .box-sub{
  font-size:12px;
  color:var(--sub-light);
}

/* chart center label */
.chart-wrap{
  position:relative;
}

.chart-center{
  position:absolute;
  top:50%; left:50%;
  transform:translate(-50%,-50%);
  text-align:center;
  pointer-events:none;
}

.chart-center .num{
  font-size:26px;
  font-weight:800;
  letter-spacing:-0.5px;
  color:var(--text);
}

.chart-center .lbl{
  font-size:11.5px;
  color:var(--sub);
  margin-top:2px;
}

/* ==========================================================
   8. RANKING
   ========================================================== */
.ranking-item{
  padding:12px 0;
  border-bottom:1px solid #F1F5F9;
}

.ranking-item:last-child{ border-bottom:none; }

.ranking-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:7px;
  font-size:13.5px;
}

.ranking-name{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:600;
}

.medal{ font-size:16px; }

.ranking-total{
  font-weight:700;
  color:var(--primary);
  font-size:13px;
}

.ranking-bar-bg{
  width:100%;
  height:7px;
  background:#F1F5F9;
  border-radius:20px;
  overflow:hidden;
}

.ranking-bar-fill{
  height:100%;
  border-radius:20px;
  background:linear-gradient(90deg,var(--primary),var(--secondary));
  width:0%;
  transition:width 1s cubic-bezier(.2,.8,.2,1);
}

/* ==========================================================
   9. CLIENTES
   ========================================================== */
.clientes-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:16px;
}

.cliente-card{
  background:var(--card);
  border:1px solid var(--border);
  padding:20px;
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-sm);
  transition:.3s;
  animation:fadeUp .5s ease both;
}

.cliente-card:hover{
  transform:translateY(-5px);
  box-shadow:var(--shadow-md);
  border-color:var(--primary-light);
}

.cliente-head{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}

.cliente-avatar{
  width:40px;
  height:40px;
  border-radius:11px;
  background:linear-gradient(135deg,var(--primary),var(--secondary));
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:14px;
  flex-shrink:0;
}

.cliente-info strong{
  font-size:14.5px;
  display:block;
}

.cliente-info small{
  color:var(--sub);
  font-size:12px;
}

.cliente-card .ranking-bar-bg{ margin-bottom:14px; }

.linha-setor{
  display:flex;
  justify-content:space-between;
  padding:7px 0;
  font-size:12.5px;
  border-bottom:1px solid #F8FAFC;
  color:var(--sub);
}

.linha-setor strong{ color:var(--text); font-weight:600; }

/* ==========================================================
   10. ATIVIDADES
   ========================================================== */
.activity-item{
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:12px 0;
  border-bottom:1px solid #F8FAFC;
  font-size:13px;
}

.activity-item:last-child{ border-bottom:none; }

.activity-dot{
  width:30px;
  height:30px;
  border-radius:9px;
  background:var(--primary-light);
  color:var(--primary);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.activity-dot svg{ width:15px; height:15px; }

.activity-text b{ display:block; font-weight:600; }
.activity-text span{ color:var(--sub-light); font-size:11.5px; }

/* ==========================================================
   11. ANIMAÇÕES GERAIS
   ========================================================== */
@keyframes fadeIn{ from{opacity:0;} to{opacity:1;} }

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

/* ==========================================================
   12. RESPONSIVO
   ========================================================== */
@media(max-width:900px){
  .dashboard{ grid-template-columns:1fr; }
  .container{ padding:20px; }
  .topbar{ flex-direction:column; align-items:flex-start; }
  .topbar-right{ width:100%; }
  .search-box{ flex:1; }
}

@media(max-width:520px){
  .stats-grid{ grid-template-columns:repeat(2,1fr); }
}
