/* ============================================================
   DASHBOARD.CSS
   ============================================================ */

.app-shell{
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: var(--bg);
}

.main-col{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar{
  height: var(--topbar-h);
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left{
  display:flex;
  align-items:center;
  gap:8px;
}

.topbar-back{
  font-size:18px;
  color:var(--ink-faint);
  text-decoration:none;
  transition:color var(--transition);
  line-height:1;
}
.topbar-back:hover{ color:var(--accent-2); }

.topbar-title{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  text-align: center;
  text-shadow: 0 1px 2px rgba(20, 20, 43, 0.08);
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:12px;
  justify-content:flex-end;
}

.topbar-user{
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.topbar-user::before{
  content: "";
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  display: inline-block;
  background-image: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.topbar-avatar{
  width:32px;
  height:32px;
  border-radius:50%;
  object-fit:cover;
  flex-shrink:0;
}

.topbar-user:has(.topbar-avatar)::before{
  display:none;
}

/* ---------- Conteúdo ---------- */
.content{
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.page-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h1{
  margin-bottom: 4px;
}

.page-head p{
  max-width: 520px;
}

/* ---------- Grid de entidades (tela inicial) ---------- */
.card-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.entity-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.entity-card:hover{
  border-color: var(--accent-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.entity-card .icon-dot{
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.entity-card h3{
  margin: 0;
}

.entity-card p{
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- Pie Chart ---------- */
.pie-wrap{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.pie{
  width: 200px;
  height: 200px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.pie-hole{
  position: absolute;
  inset: 45px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}

.pie-total{
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.pie-total-label{
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 2px;
}

.pie-legend{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pie-legend-item{
  display: flex;
  align-items: center;
  gap: 8px;
}

.pie-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pie-legend-label{
  font-size: 12.5px;
  color: var(--ink);
  min-width: 100px;
}

.pie-legend-pct{
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: right;
  min-width: 42px;
}

@media (max-width: 600px){
  .pie{
    width: 150px;
    height: 150px;
  }
  .pie-hole{
    inset: 32px;
  }
  .pie-total{
    font-size: 17px;
  }
  .pie-wrap{
    gap: 24px;
  }
}

/* ---------- Responsivo ---------- */
@media (max-width: 900px){
  .content{
    padding: 14px;
  }
}